So I have a Game Object with the following simple MonoBehaviour (note I’ve made OnBecameInvisible public!)
using UnityEngine;
using System.Collections;
public class ShowHide: MonoBehaviour
{
public void OnBecameInvisible()
{
Debug.Log("ASSERT becameInvisible and name " + name);
//enabled = false;
}
public void OnBecameVisible()
{
#if UNITY_EDITOR
if (Camera.current.name == "SceneCamera")
return;
#endif
// enabled = true;
Debug.Log("ASSERT becameVisible and name " + name);
}
}
On another Game Object I want to know when the above OnBecameInvisible() gets called.
So I am trying, but not really sure how to properly implement