Skip to content

Collection Item Property Drawer - NullReferenceException when no collection #149

@mgmhunt

Description

@mgmhunt

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;
        }


Screen Shot 2024-06-07 at 09 55 49

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions