CustomActivateTrigger
This is an enhanced version of the ActivateTrigger script included with Unity's Standard Assets.
Contents |
Public Variables
action : Mode
This defines what happens when the trigger is activated. It can have the following values:
Trigger
Uses BroadcastMessage to send a message to the target object.
Replace
This destroys the target GameObject and instantiates a copy of the source object.
Activate
This sets the active flag of the target GameObject to true.
Enable
If the target is a Behavior, this mode will enable it.
Animate
This will call Play on the animation component attached to the target GameObject.
Deactivate
This sets the active flag of the target GameObject to false.
Broadcast
This sends the message using Messenger.Broadcast.
Spawn
This will spawn an instance of the source object at the target's location
target : Object
This is the object to affect. It can be a GameObject or MonoBehaviour. If not set, it will default to the object to which the object is attached to.
source : GameObject
This must be set for the Spawn and Replace modes to do anything. Generally, it is set to a prefab that will be spawned into the scene.
triggerCount : int
This is how many times the trigger must be hit before the action is performed.
repeatTrigger : bool
If this is set to true, the action will be performed every time the trigger is hit.
message : string
This is the message that is sent from the Broadcast or Trigger modes.
runOnTrigger : bool
If true, the action is performed when OnTriggerEnter is called on the object the script is attached to.
runOnCollision : bool
If true, the action is performed when OnCollisionEnter is called on the object the script is attached to.