Most of my Unity project code is in a visual studio project, and I use Unity for UI/Rendering/wiring things together.

I renamed some fields in an object and suddenly the game, when run in unity, became unrunnably buggy. It turned out that a field I had set in the unity frontend had been unset when I renamed it.

What's a good way to avoid these sorts of problems when working with unity? I was using version control and could have reverted to an old build in the worst case, but I couldn't find any human-readable Unity Scene files that could have just shown me what I changed.


For refactoring fields check out the FormerlySerializedAs attribute. See: https://docs.unity3d.com/ScriptReference/Serialization.FormerlySerializedAsAttribute.html

When changing class names make sure that the file and the respective meta file is also renamed accordingly.

  • \$\begingroup\$ Oh fantastic, I didn't know this was a thing. Awesome. I've just always been careful to not rename my fields, or if I do, know that they're going to get untethered, and fix 'em. \$\endgroup\$ – Draco18s no longer trusts SE Apr 26 '17 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.