简体   繁体   English

覆盖Unity3D内置的CharacterController

[英]Overriding Unity3D built-in CharacterController

If I create a new C# script called CharacterController , Unity will display this warning: 如果我创建一个名为CharacterController的新C#脚本,Unity将显示以下警告:

Script 'CharacterController' has the same name as built-in Unity component. 脚本'CharacterController'与内置Unity组件具有相同的名称。 AddComponent and GetComponent will not work with this script. AddComponent和GetComponent不适用于此脚本。

Can I somehow override this (so that AddComponent and GetComponent will work)? 我可以以某种方式覆盖它(以便AddComponentGetComponent可以工作)? It doesn't seem like Unity cares about namespace for this. Unity似乎并不关心命名空间。

Unity has already stated that they won't fix this . Unity已经声明他们不会解决这个问题

This particular case has been investigated thoroughly and we have decided, in the interests of protecting the stability and features of Unity for users that rely upon the affected versions, to not address this issue. 这个特殊情况已经过彻底调查,为了保护Unity的稳定性和功能,我们已经决定依赖于受影响版本的用户不解决这个问题。

So the solution is to use a different script name. 所以解决方案是使用不同的脚本名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM