ScriptableObjectCollection
ScriptableObjectCollection copied to clipboard
Collection Item Property Drawer - NullReferenceException when no collection
I've been doing some debug of Items and pulling them into a dictionary at runtime. Don't know how to block the custom SOC drawer (?) but the NullReferenceException has been popping up fairly regularly anyway during editing - it hasn't been a problem outside of runtime as it seems to get generated when the Item is first created but then the collection registry eventually catches up.
But as I'm forced to view the Items using the drawer and some of them seem to have issues with registry I've added this line and everything seems to work fine now.
Thought I'd add an issue as the Exception occurs for me almost every time I create a new Item. But in this case it was actually corrupting the whole Inspector during Editor runtime.
Line 249 SOCSettings.cs edit
public bool GetEnforceIndirectAccess(ScriptableObjectCollection collection)
{
if (EditorApplication.isPlaying && collection == null) return false;
return GetOrCreateCollectionSettings(collection).EnforceIndirectAccess;
}