The OnObjectTriggerExit
property is an event handler that is invoked when a GameObject
exits a trigger collider. This property is part of the Collider
class in the Sandbox framework, which is used to handle physics interactions in a scene.
The OnObjectTriggerExit
property is an event handler that is invoked when a GameObject
exits a trigger collider. This property is part of the Collider
class in the Sandbox framework, which is used to handle physics interactions in a scene.
To use the OnObjectTriggerExit
property, assign a method that matches the Action<GameObject>
delegate signature. This method will be called whenever a GameObject
exits the trigger collider.
Ensure that the collider is set as a trigger by setting the IsTrigger
property to true
. This will enable the trigger functionality and allow the OnObjectTriggerExit
event to be fired.
// Example of using OnObjectTriggerExit Collider myCollider = new Collider(); myCollider.IsTrigger = true; myCollider.OnObjectTriggerExit = (GameObject obj) => { // Code to execute when a GameObject exits the trigger // For example, log the name of the object Log.Info($"GameObject {obj.Name} has exited the trigger."); };