I’m trying to make an elevator right now, with a cube that acts as the button. I’m coding in Javascript for the entire thing.
When my player collides with the cube i want it to change color to Green, and make the ElevatorUp animation play. When the elevator is on the floor needed, the cube changes color back to Red.
I have been playing this for a few days now and I have no idea what to do…
Unless you are calling OnButtonHit from somewhere else, I think you made it up by being confused with OnCollision and OnTrigger stuffs. There isn’t such callback sent, as far as I know of. Which means that’s never going to do anything.
You just need to change the function OnButtonHit to OnCollisionEnter(Collision col), then test if it’s the player. Then play the animation etc.