Unity-SerializeReferenceExtensions icon indicating copy to clipboard operation
Unity-SerializeReferenceExtensions copied to clipboard

[BUG] Copy-paste doesnt work if subclass selector used in Serializable class

Open Observer189 opened this issue 8 months ago • 3 comments

What happened?

Copy and Paste properties doesn't work if you put SerializeReference objects inside regular SerializeField objects. Per example:

Image

Then when you try to copy TestData in inspector you only get Copy option that can't copy anything related to SerializeReference:

Image

Moreover if in this setup you try to copy just filter:

Image Then when you try to paste that filter to analogous testData2 you get an exception Image

Similar problem with SubclassSelector collections. Is this intended or it's a bug? And if it's not bug then can you please add support for such type of Copy-Paste

Package Version

1.6.1

Unity Version

6000.3.7f1

Observer189 avatar Mar 16 '26 13:03 Observer189

This is occurring because of JsonUtility.FromJsonOverwrite, if the value that is being assigned to is currently null it will throw that error. This project currently has no handling for when trying to paste into a null target.

Logyrac avatar Jul 12 '26 17:07 Logyrac

I have created a PR for this issue (As well as other type-safety checks when pasting) #103, we'll see where that goes when reviewed.

Logyrac avatar Jul 13 '26 06:07 Logyrac

Thank you for the report and reproduction details. #107 has been merged into main and fixes the exception when pasting a single managed reference into a null destination. This includes individual references inside ordinary serializable parents and individual elements of managed-reference collections. I am closing this issue as completed for that paste bug.

We are declining support for copying an entire [SerializeField] parent object or a whole collection. Copying a general serialized object tree would expand this package beyond its scope of selecting and editing individual managed-reference fields.

mackysoft avatar Oct 15 '26 12:10 mackysoft