Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 3: Finishing the Game Loop

Create a ButtonScript with Collision Events

You don’t have access to this lesson

Please register or sign in to access the course content.

To check whether a player is standing on the button, we’ll use Collision Events, which work exactly the same way as Trigger Events, but won’t let us just walk into the button, and instead weight for entities to start and stop touching this object. 

  1. In the Entity menu, create a new script for the button called ButtonScript.
  2. In the ButtonScript, delete the start and tick functions.
  3. Create two new functions onCollisionEnter and onCollisionExit, and give them both a parameter called other of type Entity.
  4. In each function, log other.name + a string message about what they are doing in each function.