- Home /
 
               Best Answer 
              
 
              Answer by ExtinctSpecie · Apr 04, 2017 at 12:30 PM
 using UnityEngine;
 using System.Collections;
 using System;
 using UnityEngine.Events;
 using UnityEngine.EventSystems;
 
 
 public class MyClickTrigger : MonoBehaviour , IPointerClickHandler
 {
     #region IPointerClickHandler implementation
 
     public void OnPointerClick (PointerEventData eventData)
     {
         MyOwnEventTriggered ();
     }
 
     #endregion
 
     //my event
     [Serializable]
     public class MyOwnEvent : UnityEvent { }
 
     [SerializeField]
     private MyOwnEvent myOwnEvent = new MyOwnEvent();
     public MyOwnEvent onMyOwnEvent { get { return myOwnEvent; } set { myOwnEvent = value; } }
 
     public void MyOwnEventTriggered()
     {
         onMyOwnEvent.Invoke();
     }
 
 }
 ///add a collider to the object as well so the OnPointerClick can work
How do you make the script do what you input? It shows in the inspector but doesn't Do what I put in.
@ExtinctSpecie Why is on$$anonymous$$yOwnEvent a property? It looks like the exact same behaviour as a normal variable
Your answer
 
 
             Follow this Question
Related Questions
Button UI, OnClick() - Calling Bool Function 1 Answer
Make panel inactive on second click 1 Answer
UI button stops working after reload scene 1 Answer
Creating working UI Button from Script? 1 Answer
Multiple Cars not working 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                
