Will renaming a Serializable class wipe its instances in the Inspector?

I have a class named MenuItem and just recently, I found out the namespace “MenuItem” is used by editor extensions such as Prototype, so I’m looking into changing it. I’d like to know if I’ll have to define all of my menus all over again.

Your question title and body don't match. Just rename your class, most IDEs have basic refactoring/renaming functionalities. What IDE you're using? if any?

–

I guess I'm using the built-in Unity IDE, if that's a thing.

–

1 Answer

1

I’ve actually had good luck with this. Doing multiple conversions from UnityScript(JavaScript) to C# and copying the scene(originals done with scripts in UnityScript) to include my c# scripts, i have been able to keep the properties/fields with the same names between the scripts and replace the UnityScript version with the c# version and the values carried over. But your scripts may be different, i’m not sure. It would be wise to backup and give a go on the backup and not the main code base(or if you us SVN/GIT/ETC just revert if failure).

Will do and report back, thanks already.

–

Wiped. Not the answer I like, but it is one.

–

I just tried it the way Landern suggested and had no problem. Unity metadata is pretty resilient. You can rename scripts, change namespaces and even remove and return fields and the metadata will stay intact.

–