Advertisement
leomovskii

PhysicButton

Nov 9th, 2024
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.30 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.Events;
  3.  
  4. public class PhysicButton : MonoBehaviour {
  5.  
  6.     public bool interactable = true;
  7.     public bool loop = true;
  8.  
  9.     public UnityEvent OnClick;
  10.  
  11.     private void OnMouseDown() {
  12.         if (interactable) {
  13.             interactable = loop;
  14.  
  15.             OnClick.Invoke();
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement