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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值