what is trigger and the uses? scripting

i found this in script and visual logic editor. I just don't know it, so noob. :(

2 Answers

2

A trigger is related to colliders from the physics engine. Unity documentation states that: "An alternative way of using Colliders is to mark them as a Trigger, just check the IsTrigger property checkbox in the Inspector. Triggers are effectively ignored by the physics engine, and have a unique set of three trigger messages that are sent out when a collision with a Trigger occurs. Triggers are useful for triggering other events in your game, like cutscenes, automatic door opening, displaying tutorial messages, etc. Use your imagination!"

For more info see:

http://unity3d.com/support/documentation/Components/class-SphereCollider.html

this is a better answer

Basically, triggers are colliders that are capable of executing script when a collider touches the trigger, exits the trigger, or while the collider touches the trigger via OnTriggerEnter,OnTriggerExit, or OnTriggerStay. You also optionally have access to the collider that touched your trigger. For detailed info, here are the docs:

http://unity3d.com/support/documentation/ScriptReference/Collider.html

http://unity3d.com/support/documentation/Components/class-BoxCollider.html

Be sure to checkmark the isTrigger box on your collider in the inspector and check the "collision action matrix" chart to ensure your trigger can detect the objects you'd like to detect. Also be sure to check out the project settings under Physics to make sure objects and your trigger are allowed to collide.