Add a new class ManagedReferenceBase (non-breaking additive change) and a serializable wrapper for inlined values using [SerializeReference] to support polymorphic managed references.
Implementation sketch:
- New file: Runtime/Base/ManagedReferenceBase.cs
- [Serializable]
- public class ManagedReference { [SerializeReference] public T value; }
- public class ManagedReferenceBase : ReferenceBase {
// Keep existing behavior; add a new public ManagedReference inlinedManaged;
// add editor support to draw and toggle between inlinedManaged and variable.
}
- Editor: add PropertyDrawer/CustomPropertyDrawer that handles ManagedReference wrapper and offers type picker (uses TypeCache or assembly scan to list concrete types assignable to T).
- CloningTools: extend Clone to handle managed references wrapped in ManagedReference and deep clone lists of [Serializable] types (already present but document caveats).
Testing:
- Unit tests for cloning lists of [Serializable] classes and structs.
- Playmode tests for resetting and preserving protectedDontReset flag.
Docs:
- Update README: add section "Polymorphic and complex managed types" with examples for [SerializeReference], wrapper usage, and migration instructions.
Add a new class ManagedReferenceBase (non-breaking additive change) and a serializable wrapper for inlined values using [SerializeReference] to support polymorphic managed references.
Implementation sketch:
// Keep existing behavior; add a new public ManagedReference inlinedManaged;
// add editor support to draw and toggle between inlinedManaged and variable.
}
Testing:
Docs: