Skip to content

Issue with adding event to listener #18

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/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/ScriptableEvents/ScriptableEvent.cs:27)
GenericScriptableArchitecture.EventHolder.AddListener (GenericScriptableArchitecture.VoidScriptableEventListener listener) (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/EventHolders/EventHolder.cs:18)
GenericScriptableArchitecture.VoidScriptableEventListener.OnEnable () (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/ScriptableEventListeners/VoidScriptableEventListener.cs:23)
UnityEngine.Behaviour:set_enabled(Behaviour, Boolean)
GenericScriptableArchitecture.ScriptableEventListener:OnEnable() (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/ScriptableEventListeners/ScriptableEventListener.cs:13)

NullReferenceException: Object reference not set to an instance of an object
GenericScriptableArchitecture.Editor.ScriptableEventListenerEditorHelper.DrawResponse () (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Editor/ScriptableEventListenerEditor.cs:71)
GenericScriptableArchitecture.Editor.ScriptableEventListenerEditorHelper.DrawInlineGUI () (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Editor/ScriptableEventListenerEditor.cs:52)
GenericScriptableArchitecture.Editor.WildcardScriptableEventListenerEditor.OnInspectorGUI () (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/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/com.solidalloy.generic-scriptable-architecture@1.4.1/Editor/ScriptableEventListenerEditor.cs:71)
GenericScriptableArchitecture.Editor.ScriptableEventListenerEditor.OnInspectorGUI () (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/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/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/ScriptableEvents/ScriptableEvent.cs:29)
GenericScriptableArchitecture.EventHolder.RemoveListener (GenericScriptableArchitecture.VoidScriptableEventListener listener) (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/EventHolders/EventHolder.cs:35)
GenericScriptableArchitecture.VoidScriptableEventListener.OnDisable () (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/ScriptableEventListeners/VoidScriptableEventListener.cs:34)
UnityEngine.Behaviour:set_enabled(Behaviour, Boolean)
GenericScriptableArchitecture.ScriptableEventListener:OnDisable() (at Library/PackageCache/com.solidalloy.generic-scriptable-architecture@1.4.1/Runtime/ScriptableEventListeners/ScriptableEventListener.cs:19)

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

And with on:

1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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