OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger.
// Applies an upwards force to all rigidbodies that enter the trigger. function OnTriggerStay (other : Collider) { if (other.attachedRigidbody) { other.attachedRigidbody.AddForce(Vector3.up * 10); } }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnTriggerStay(Collider other) { if (other.attachedRigidbody) other.attachedRigidbody.AddForce(Vector3.up * 10); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnTriggerStay(other as Collider) as void: if other.attachedRigidbody: other.attachedRigidbody.AddForce((Vector3.up * 10))