Advertisement
Guest User

ClickObject.cs

a guest
Oct 21st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class ClickObject : MonoBehaviour {
  6.    
  7.     public bool click = false;
  8.     public GameObject UIObject;
  9.    
  10.     void Start () {
  11.         UIObject.SetActive(false);
  12.     }
  13.    
  14.     void Update () {
  15.         if (click == true) {
  16.             Debug.Log("UIObject = true");
  17.             UIObject.SetActive(true);
  18.         }
  19.         else UIObject.SetActive(false);
  20.     }
  21.    
  22.     void OnMouseDown() {
  23.         if (click == false) {
  24.             Debug.Log("Click = true");
  25.             click = true;
  26.         }
  27.     }
  28.    
  29.     public void HideUI() {
  30.         Debug.Log("Click = false, UIObject = false");
  31.         click = false;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement