create event on collision

How do I do so that when the character collides with and object(an invisible object that the player can walk through) an event comes. like an object will be created or something will be moved.

for instance. the Character moves in a hallway and walks into this trigger object(walks through it) and then a door will be closed.(the door is just an example)

Tag your character as “Player” and then add this script to your trigger object(s):

function OnTriggerEnter(other : Collision){

function DoSomething(){
//code that will close door

Good luck with the project!

OnCollisionEnter is what you need.

Likewise, there is OnTriggerEnter.