Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

if button is pressed unity

    using UnityEngine;
    using System.Collections;
    using UnityEngine.EventSystems;
     
    public class MyButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
     
    public bool buttonPressed;
     
    public void OnPointerDown(PointerEventData eventData){
         buttonPressed = true;
    }
     
    public void OnPointerUp(PointerEventData eventData){
        buttonPressed = false;
    }
    }
 
PREVIOUS NEXT
Tagged: #button #pressed #unity
ADD COMMENT
Topic
Name
8+2 =