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.
- In the Entity menu, create a new script for the button called ButtonScript.
- In the ButtonScript, delete the start and tick functions.
- Create two new functions onCollisionEnter and onCollisionExit, and give them both a parameter called other of type Entity.
- In each function, log other.name + a string message about what they are doing in each function.