unity 在Game视图中显示Gizmos


自己画的Gizmos要想在Game视图中能看到,需要把Game视图窗口右上角的"Gizmos"按钮点下去。如图:

比如,下面代码以角色的capsuleCollider中心为中心画一个半径为0.8f的球体线框。

void OnDrawGizmos() {

        Vector3 capsuleColliderCenterInWorldSpace=GetComponent<CapsuleCollider> ().transform.TransformPoint (GetComponent<CapsuleCollider>().center);
        Gizmos.color = Color.yellow;
        Gizmos.DrawWireSphere (capsuleColliderCenterInWorldSpace,0.8f);
}

另外,如果在Scene视图中选中某个物体显示出其Gizmos,则切换到Game视图后只要将"Gizmos"按钮按下,则在Game视图下也能显示出此Gizmos。

 

参考:http://answers.unity3d.com/questions/224400/gismo-in-game-view.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM