Advertisemen
Let's say want cube to jump when you push the button.
Just for the demonstration purpose create two cubes in Unity and name one of as button. Then, create two scripts called - classA and classB. Attach classA in the button cube and classB in another cube. And type the followings in classA and classB -
classA script -
It sends message to the referenced cube saying execute "JumpCube" function OnMouseDown with the speed of 400. DontRequireReceiver means if it can't find "JumpCube" function in the another cube, no error will be called in unity.
classB script -

Advertisemen
Tidak ada komentar:
Posting Komentar