In this tutorial we will use a collision event to control other objects via their scripts and public variables. We will detect the collisions and then import object scripts and change their variables from another script. The tutorial will use the pingpong script applied to a platform to stop its movement using a decision "IF" structure.
Don’t forget the rigid body.
Dont forget to put a Sphere Collider on both objects.
We will use code to get the object properties and scripts assigned to the game objects. With this information, we will adjust the public variables and control the game objects.
Changing variables (boolean and floats) to start and stop movement will help you create interactive games and platform controls.
Useful tutorials to help build projects:
Download
0 formats
No download links available.
Unity - Controlling Scripts through event collisions and public variables | NatokHD