Skip to content

LogicEditor | ForceSingleInstance fails in scenes without LogicEditor

Summary

When opening scenes in Unity that do not already have a LogicEditor, an Error is thrown.

Steps to reproduce

  1. Open any scene without Logic Editor
  2. Observe the error noted below

It seems SetUI() is called on hierarchy changes (like scene switching) regardless of if the Graph is open or not. The implementation in AClickNode does not check, if a LogicEditor is available in the scene and therefore fails when trying to access that.

What is the current bug behavior?

An error is thrown in scenes without LogicEditor

What is the expected correct behavior?

What would you like to happen instead?


Version

0.4.1-0.4.3

Build Target

All

Mode

In Editor


Relevant logs and/or screenshots

NullReferenceException: Object reference not set to an instance of an object
Figments.Modules.LogicEditor.Objects.LogicObjectId.GetGameObject (System.String id) (at Assets/Figments/Modules/LogicEditor/Objects/LogicObjectId.cs:137)
Figments.Modules.LogicEditor.Creation.Unity.Node.ActivatorReactor.AClickNodeView.AddManagedMessages () (at Assets/Figments/Modules/LogicEditor/Creation/Unity/Node/ActivatorReactor/AClickNode.cs:55)
UnityEditor.EditorApplication.Internal_CallHierarchyHasChanged () (at <1f0be198f5164d2489de92f22c998266>:0)

Possible fixes

A simple fix would be to add a check to AClickNode to verify a LogicEditor is available. A better fix would be to only perform SetUI when the Graph is open and a LogicEditor is available.