Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity button press

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;
  }
}
Source by forum.unity.com #
 
PREVIOUS NEXT
Tagged: #unity #button #press
ADD COMMENT
Topic
Name
7+9 =