UnityException: Gizmo drawing functions can only be used in OnDrawGizmos and OnDrawGizmosSelected.

You don't have to call OnDrawGizmos() From anywhere, it is a editor function to display gizmos in the scene-view and is called automatically called!!

不能在任何地方调用 OnDrawGizmos(),这个函数是自动调用的。这个函数是编辑器函数,用来在scene-view 窗口画gizmos的。

所以把代码中调用这个函数的地方删除就行了。


【挂在物体上的脚本,运行起来发现前面的小勾没有了,没注意看console信息,原来是有uintyException导致的】


https://answers.unity.com/questions/1500556/tried-to-call-a-gizmos-drawing-method-in-ondrawgiz.html



猜你喜欢

转载自blog.csdn.net/u012138730/article/details/80763402