Closed cbaggers closed 3 years ago
I added this Log
call above the call to FromJsonOverwrite
else if (typeof(UnityEngine.Object).IsAssignableFrom(type))
{
UnityEngine.Debug.Log("~~~ name was:" + serializedName+ " Type was: " + type.FullName + ". Json:\nvvvvvvv\n" + serializedValue + "\n^^^^^^^");
ObjectWrapper obj = new ObjectWrapper();
JsonUtility.FromJsonOverwrite(serializedValue, obj);
value = obj.value;
}
On the first attempt of loading the project Unity started with the You can't dereference a PPtr while loading
error, however the second time it crashed I got this:
~~~ name was: Type was: UnityEngine.GameObject. Json:
vvvvvvv
{"value":{"instanceID":14012}}
^^^^^^^
I grepped for the instanceId and found the json in question in Assets/Examples/ExposedGetProperties.asset
which makes sense.
I've got no conclusions yet but I hope the data is useful
Hmm I guess the issue was that somehow the graph asset itself ended up containing a reference to a GameObject. The repercussions make some sense given that happening.
I can force the issue by doing the following:
ExposedGetProperties
asset in the Project panelExposedGetProperties
asset in the graph view.Save Asset
Next time the project loads you'll get the issue.
The question now remains what I did to cause this the first time. The above actions are pretty dumb so I'd like to think that it can happen another way. However poking around like a noob combined with a few drinks could account for it, and that was definitely the situation I was in.
I wonder if allowSceneObjects would help here
[edit] Actually it seems that the reference has been in there for a while. Last change was here 14a0ae1899e581933a49619fc83df0b6f452d840
Yeah, I saw this error a while ago. I think the only way to fix this issue is to use the new [SerializeReference] attribute instead of the slow and ugly JSON serialization but it's a big task and will require migration step for old graphs.
Btw I think the object serialization is wrong too, it's serializing an object just with the instance id:
{"value":{"instanceID":14012}}
But the instance id is only valid for the time of the editor session after you restart they will point on other assets. You need to serialize the fileId
instead to be sure the asset reference isn't lost after restarting the editor.
IIRC they use something like this in ShaderGraph too but their version is working: https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.shadergraph/Editor/Data/Graphs/SerializableTexture.cs
First off, fantastic project. I'm thoroughly impressed with where is going.
Unity version is
2019.3.15f1
Either Unity crashes while loading or, if it does load, I have this error in the console.
I checked the
Editor.log
and found this that looked relevant:line 54 can be seen here
which is odd as the documentation for FromJsonOverwrite makes it look like this this should be safe from threads other than main.
I'll post more if I find it.