Unity3D-SerializableInterface
Unity3D-SerializableInterface copied to clipboard
fix: ClassesOnlyAttribute is Runtime Attribute
Proposed changes
Currently, ClassesOnlyAttribute resides in an editor-only assembly, which requires using #if UNITY_EDITOR guards when referenced from runtime code:
#if UNITY_EDITOR
[ClassesOnly]
#endif
[SerializeField] SerializableInterface<X> x;
This change moves ClassesOnlyAttribute into a runtime assembly, eliminating the dependency on editor assemblies and removing the need for conditional compilation in runtime code.
Types of changes
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] Refactoring (no functional changes, no api changes)
- [ ] Code style update (formatting, renaming)
- [ ] Build related changes (workflow changes)
- [ ] Documentation Update (readme, changelog)
- [ ] Other, please describe:
What is the current behavior?
Using ClassesOnlyAttribute requires referencing TNRD.SerializableInterface.Editor.asmdef, and for runtime code this necessitates an #if UNITY_EDITOR guard.
What is the new behavior?
Using ClassesOnlyAttribute will only require referencing TNRD.SerializableInterface.asmdef.
Checklist
- [x] The code compiles
- [x] I have tested that this doesn't break existing code (unless it is an explicit breaking change)
- [x] I have tested that the (new) functionality/fix works as intended