ScriptableObjects corrupted? Reaching "uneditable/unreferenceable" state in Inspector
I have a few ScriptableObjects (in this case, GunData) and I've been able to successfully create/reference assets in a GunData field in the inspector.
Occasionally, these assets will become unable to be referenced or edited in the inspector, although I've confirmed that the file contents are exactly the same as they were.
I posted a GIF of this on Twitter: https://twitter.com/Ploogle/status/1026228856448057350
I have no idea what's going on. Any ideas?
Try press Ctrl + S (refresh scriptable object might help too). It will save changed scriptable object to Disk.
Ctrl + S isn't working, probably because the asset isn't loading into the Inspector at this point.
I can see that the binaries look good. For comparison, two ScriptableObject .asset files, first one loads and the second does not:
%YA$$anonymous$$L 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!114 &11400000 $$anonymous$$onoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 0} m_Name: Gun_ m_EditorClassIdentifier: Assembly-CSharp::GunData RateOfFire: 1 $$anonymous$$agazineSize: 1 ReloadSpeed: 1 TurnRate: 1 Range: 0 FireType: 0 Sight: {fileID: 0} ProjectileTemplate: {fileID: 0}
%YA$$anonymous$$L 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!114 &11400000 $$anonymous$$onoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 0} m_Name: Gun_NewGun m_EditorClassIdentifier: Assembly-CSharp::GunData RateOfFire: 1 $$anonymous$$agazineSize: 1 ReloadSpeed: 1 TurnRate: 1 Range: 0 FireType: 0 Sight: {fileID: 0} ProjectileTemplate: {fileID: 0}
I remember in old Unity 5+. Scriptable object asset have bugs not update to last to date with the script.
So like if you change the scripts for data of GunData. The old scriptable object might not compatible with new Gundata Scripts => Unity mistook data and script.
Other mistake is like not set scriptable object for System.Serializeable
Answer by YaGa · Dec 05, 2021 at 02:32 PM
Try clean and rebuild your solution. That works for me, sometimes after view tries.
Your answer
