OnBecameInvisible is called when the renderer is no longer visible by any camera.
// Disables the behaviour when it is invisible function OnBecameInvisible () { enabled = false; }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnBecameInvisible() { enabled = false; } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnBecameInvisible() as void: enabled = false