WoodyDRN
WoodyDRN

Reputation: 1261

Overriding Unity3D built-in CharacterController

If I create a new C# script called CharacterController, Unity will display this warning:

Script 'CharacterController' has the same name as built-in Unity component. AddComponent and GetComponent will not work with this script.

Can I somehow override this (so that AddComponent and GetComponent will work)? It doesn't seem like Unity cares about namespace for this.

Upvotes: 1

Views: 613

Answers (1)

Lews Therin
Lews Therin

Reputation: 3777

Unity has already stated that they won't fix this.

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.

So the solution is to use a different script name.

Upvotes: 3

Related Questions