Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class SpecDescription : MonoBehaviour
  6. {
  7.  
  8. public GameObject canv; //In the inspector, you're supposed to drag the canvas on this
  9. void Start()
  10. {
  11.  
  12. }
  13.  
  14. // Update is called once per frame
  15. private void OnMouseDown()
  16. {
  17.  
  18. if (Input.GetMouseButtonDown(0))
  19. {
  20. Debug.Log("Left click on object, open canvas.");
  21. canv.SetActive(true);
  22.  
  23. }
  24.  
  25.  
  26. }
  27.  
  28. public void Update ()
  29. {
  30. if (Input.GetMouseButtonDown(1))
  31. {
  32. Debug.Log("Right click anywhere on the screen, close canvas.");
  33. canv.SetActive(false);
  34. }
  35.  
  36. }
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement