Reputation: 31
I'm new to unity and c#.
When i air tap on the left sphere, the plane and the right sphere should appear.
I figured that an OnPointerClicked event on the left sphere the animation of the plane and right sphere triggers (with an if/else statement). Is this the way to go? If so, how do i do that?
Or is there an easier method?
Thats the script of the left sphere:
Upvotes: 1
Views: 478
Reputation: 2882
Read this: IPointerClickHandler.OnPointerClick
You need to implement the interface, i.e. IPointerClickHandler
in your MonoBehaviour class. When you click on the object in game, it will send a click event to EventSystem, which triggers the function body you have in your OnPointerClick
method.
So as the doc mentioned, also make sure you have an EventSyetem (an empty game object with the script attached, or attach the component to your main camera).
Upvotes: 1