Renderer.OnBecameVisible 变得可见

function OnBecameVisible () : void

Description描述

OnBecameVisible is called when the object became visible by any camera.

当物体由任意摄像机变为可见时,OnBecameVisible被调用

This message is sent to all scripts attached to the renderer. OnBecameVisible and OnBecameInvisible are useful to avoid computations that are only necessary when the object is visible.

这个消息发送到附加到该渲染器的所有脚本。OnBecameVisibleOnBecameInvisible对避免计算非常有用的,只需要当物体可见时计算。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnBecameVisible() {
		enabled = true;
	}
}
// Enables the behaviour when it is visible
//当物体可见时启用这个行为
function OnBecameVisible() {
enabled = true;
}

Note: when running in the editor, scene view cameras will also cause this function to be called.

注意:当运行在编辑器,场景视图摄像机也将导致这个函数被调用。

参见: OnBecameInvisible, isVisible.

Page last updated: 2010-12-17