ScriptableObjectVariant icon indicating copy to clipboard operation
ScriptableObjectVariant copied to clipboard

NullReferenceExceptions when selecting or deselecting a scriptable object with the SOVariant attribute.

Open simonstix opened this issue 3 years ago • 1 comments

I'm using Unity 2022.1.6 with Odin 3.1.10

I think this is caused by some change in Odin. In line 56 in SOVariantAttributeProcessor.cs Property.Tree.SerializedObject is null.

I was able to fix this by replacing the line with:

_soVariant = new SOVariant<T>(ValueEntry.SmartValue);

I'm not sure if this could cause other problems because SmartValue has some additional logic by Odin.

simonstix avatar Jan 27 '23 12:01 simonstix

Hy @Nonakesh

Sorry for taking so long for getting back to this!

I've made significant changes to the package, it broke all the time, mostly because of the unity importer being too clunky fro the data to be saved in the metadata. I've moved saving the parent/child structure from the metadata to a scriptable object library.

I've at the same time updated everything to Unity 2022.3.16 and Odin 3.2.1.0.

I am still testing the new code, but if you'd like to have a look, you can access it here: https://github.com/GieziJo/ScriptableObjectVariant.git#SOData

I've also written some code to update the system from the old one to the new package (c.f. upgrade guid).

I haven't seen this error since, but will keep it in mind if it pops up.

Thanks a lot!

GieziJo avatar Jan 03 '24 18:01 GieziJo