Skip to content

fix: ClassesOnlyAttribute is Runtime Attribute#65

Merged
Thundernerd merged 1 commit into
Thundernerd:mainfrom
c3-hoge-fuga-piyo:patch
Jun 2, 2026
Merged

fix: ClassesOnlyAttribute is Runtime Attribute#65
Thundernerd merged 1 commit into
Thundernerd:mainfrom
c3-hoge-fuga-piyo:patch

Conversation

@c3-hoge-fuga-piyo
Copy link
Copy Markdown
Contributor

@c3-hoge-fuga-piyo c3-hoge-fuga-piyo commented Nov 26, 2025

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)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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

  • The code compiles
  • I have tested that this doesn't break existing code (unless it is an explicit breaking change)
  • I have tested that the (new) functionality/fix works as intended

@tiberiu
Copy link
Copy Markdown

tiberiu commented Jun 2, 2026

Yes please, I actually came here looking for this exact situation.

@Thundernerd Thundernerd merged commit 8c43f44 into Thundernerd:main Jun 2, 2026
lgarczyn added a commit to lgarczyn/Unity3D-SerializableInterface that referenced this pull request Jun 2, 2026
fix: ClassesOnlyAttribute is Runtime Attribute (Thundernerd#65)
github-actions Bot pushed a commit that referenced this pull request Jun 2, 2026
## [2.2.2](v2.2.1...v2.2.2) (2026-06-02)

### Bug Fixes

* ClassesOnlyAttribute is Runtime Attribute ([#65](#65)) ([8c43f44](8c43f44))
github-actions Bot pushed a commit that referenced this pull request Jun 2, 2026
## [2.2.2](v2.2.1...v2.2.2) (2026-06-02)

### Bug Fixes

* ClassesOnlyAttribute is Runtime Attribute ([#65](#65)) ([8c43f44](8c43f44))
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

🎉 This PR is included in version 2.2.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants