Skip to content

Issue with adding event to listener #18

@sima995

Description

@sima995

For some reason when adding an event to a Scriptable Event listener and entering play mode these errors happen:

NullReferenceException: Object reference not set to an instance of an object
GenericScriptableArchitecture.ScriptableEvent.AddListener (GenericScriptableArchitecture.IListener listener) (at Library/PackageCache/[email protected]/Runtime/ScriptableEvents/ScriptableEvent.cs:27)
GenericScriptableArchitecture.EventHolder.AddListener (GenericScriptableArchitecture.VoidScriptableEventListener listener) (at Library/PackageCache/[email protected]/Runtime/EventHolders/EventHolder.cs:18)
GenericScriptableArchitecture.VoidScriptableEventListener.OnEnable () (at Library/PackageCache/[email protected]/Runtime/ScriptableEventListeners/VoidScriptableEventListener.cs:23)
UnityEngine.Behaviour:set_enabled(Behaviour, Boolean)
GenericScriptableArchitecture.ScriptableEventListener:OnEnable() (at Library/PackageCache/[email protected]/Runtime/ScriptableEventListeners/ScriptableEventListener.cs:13)

NullReferenceException: Object reference not set to an instance of an object
GenericScriptableArchitecture.Editor.ScriptableEventListenerEditorHelper.DrawResponse () (at Library/PackageCache/[email protected]/Editor/ScriptableEventListenerEditor.cs:71)
GenericScriptableArchitecture.Editor.ScriptableEventListenerEditorHelper.DrawInlineGUI () (at Library/PackageCache/[email protected]/Editor/ScriptableEventListenerEditor.cs:52)
GenericScriptableArchitecture.Editor.WildcardScriptableEventListenerEditor.OnInspectorGUI () (at Library/PackageCache/[email protected]/Editor/WildcardScriptableEventListenerEditor.cs:66)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <0a0112aba4da4a0fb8c9c006141c0ff8>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
NullReferenceException: Object reference not set to an instance of an object
GenericScriptableArchitecture.Editor.ScriptableEventListenerEditorHelper.DrawResponse () (at Library/PackageCache/[email protected]/Editor/ScriptableEventListenerEditor.cs:71)
GenericScriptableArchitecture.Editor.ScriptableEventListenerEditor.OnInspectorGUI () (at Library/PackageCache/[email protected]/Editor/ScriptableEventListenerEditor.cs:238)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <0a0112aba4da4a0fb8c9c006141c0ff8>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

When exiting playmode:

NullReferenceException: Object reference not set to an instance of an object
GenericScriptableArchitecture.ScriptableEvent.RemoveListener (GenericScriptableArchitecture.IListener listener) (at Library/PackageCache/[email protected]/Runtime/ScriptableEvents/ScriptableEvent.cs:29)
GenericScriptableArchitecture.EventHolder.RemoveListener (GenericScriptableArchitecture.VoidScriptableEventListener listener) (at Library/PackageCache/[email protected]/Runtime/EventHolders/EventHolder.cs:35)
GenericScriptableArchitecture.VoidScriptableEventListener.OnDisable () (at Library/PackageCache/[email protected]/Runtime/ScriptableEventListeners/VoidScriptableEventListener.cs:34)
UnityEngine.Behaviour:set_enabled(Behaviour, Boolean)
GenericScriptableArchitecture.ScriptableEventListener:OnDisable() (at Library/PackageCache/[email protected]/Runtime/ScriptableEventListeners/ScriptableEventListener.cs:19)

The component also draws wierdly with show generated components off:
2

And with on:

1

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