using UnityEngine;
using System.Collections;
public class LOVE : MonoBehaviour {
bool mVisible = true;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (mVisible)
{
// Debug.Log("CubeRed Update");
}
}
void OnBecameVisible()
{
Debug.Log("CubeRed OnBecameVisible");
mVisible = true;
}
void OnBecameInvisible()
{
Debug.Log("CubeRed OnBecameInvisible");
mVisible = false;
}
}
原文:http://www.cnblogs.com/ZeroMurder/p/5825302.html