Advertisement
KencoderHK

NotHitTransparent.CS

Apr 26th, 2019
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class NotHitTransparent : MonoBehaviour
  7. {
  8.     [Range(0, 1)] public float threshold = 0.5f;
  9.  
  10.     // Start is called before the first frame update
  11.     void Start()
  12.     {
  13.         Image image = GetComponent<Image>();
  14.         if(image != null) {
  15.             image.alphaHitTestMinimumThreshold = threshold;
  16.         } else {
  17.             Debug.Log("Image is null!!");
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement