Request a way to specify property's serialized name #11174
Unanswered
shrinktofit
asked this question in
Ideas
Replies: 2 comments
-
I don't think I have ever consider about this idea, really interesting.
For point 3, I think we should use symbol.description as the default name.
For point 4, are you sure? Even Unity does not resolve the readability of yaml. When serialization issues arise, they often require R&D troubleshooting, and the more aliases there are, the more the burden of troubleshooting increases IMO. Why not just Keep It Simple and Stupid. Besides. If we support serialization-alias. I think the only way to avoid
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Creator serializes property's name as-is and prohibit serializating accessors. An object might be serialized as the following:
Sometime this troubles.
Issues while refactoring
It's a common pattern that people refactor the code to encapslute a property. That's, refactor
@ccclass class Meow { @property p = 0; }
to the above structure.This breaks old serialized data since the property's name is changed from "p" to "_p".
Issues when the property key is not a plain string literal
All properties in the following class can not be serialized:
Readability
Creator asset files are designed to be human-readable. It's nice if we could eliminate the
_
orm_
prefix in serialized assets.All these issues are related to "we can't specify a serialization name to a property". So I'm requesting such a feature.
It may look like:
If users have theirown name convention, they may even extends this property, to reduce size of serialized asset:
Beta Was this translation helpful? Give feedback.
All reactions