MonoBehaviour
- Awake
- CancelInvoke
- FixedUpdate
- InvokeRepeating
- Invoke
- IsInvoking
- LateUpdate
- OnApplicationFocus
- OnApplicationPause
- OnApplicationQuit
- OnBecameInvisible
- OnBecameVisible
- OnCollisionEnter
- OnCollisionExit
- OnCollisionStay
- OnConnectedToServer
- OnControllerColliderHit
- OnDestroy
- OnDisable
- OnDisconnectedFromServer
- OnDrawGizmosSelected
- OnDrawGizmos
- OnEnable
- OnFailedToConnectToM...
- OnFailedToConnect
- OnGUI
- OnJointBreak
- OnLevelWasLoaded
- OnMasterServerEvent
- OnMouseDown
- OnMouseDrag
- OnMouseEnter
- OnMouseExit
- OnMouseOver
- OnMouseUpAsButton
- OnMouseUp
- OnNetworkInstantiate
- OnParticleCollision
- OnPlayerConnected
- OnPlayerDisconnected
- OnPostRender
- OnPreCull
- OnPreRender
- OnRenderImage
- OnRenderObject
- OnSerializeNetworkView
- OnServerInitialized
- OnTriggerEnter
- OnTriggerExit
- OnTriggerStay
- OnWillRenderObject
- Reset
- StartCoroutine
- Start
- StopAllCoroutines
- StopCoroutine
- Update
- useGUILayout
MonoBehaviour.OnDrawGizmosSelected 当选择时绘制Gizmos
function OnDrawGizmosSelected () : void
Description描述
Implement this OnDrawGizmosSelected if you want to draw gizmos only if the object is selected.
如果你想在物体被选中时绘制gizmos,执行这个函数。
Gizmos are drawn only when the object is selected. Gizmos are not pickable. This is used to ease setup. For example an explosion script could draw a sphere showing the explosion radius.
Gizmos只在物体被选择的时候绘制。Gizmos不能被点选,这可以使设置更容易。例如:一个爆炸脚本可以绘制一个球来显示爆炸半径
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float explosionRadius = 5.0F;
void OnDrawGizmosSelected() {
Gizmos.color = Color.white;
Gizmos.DrawSphere(transform.position, explosionRadius);
}
}
var explosionRadius : float = 5.0;
function OnDrawGizmosSelected () {
// Display the explosion radius when selected
// 被选中时显示爆炸半径.
Gizmos.color = Color.white ;
Gizmos.DrawSphere (transform.position, explosionRadius);
}
最后修改:2011年1月2日 Sunday 17:53