OnBecameVisible 和 OnBecameInvisible ,OnWillRenderObject 只有在所挂物体(不包括子物体)有render才有效
//当可见时开启此行为
void OnBecameVisible()
{
_isVisible = true;
}
//当不可见时禁用这行为
private void OnBecameInvisible()
{
_isVisible = false;
}
OnBecameVisible:当renderer(渲染器)在任何相机上可见时调用OnBecameVisible。
OnBecameInvisible:当renderer(渲染器)在任何相机上都不可见时调用OnBecameInvisible。