xNode icon indicating copy to clipboard operation
xNode copied to clipboard

Unity crashes when editing enum properties in a node (using Odin)

Open sp-tania-anta opened this issue 5 years ago • 2 comments

We're using XNode in our project to create a cutscene system and we've noticed that sometimes editing values in nodes caused Unity to crash.

I've managed to isolate the source of the crashes to changing values in enum fields when Xnode uses Odin. It is easy to reproduce in an empty project.

Setup:

  • Unity 2019.4.0f1 or 2020.1.2 MacOS.
  • XNode v1.8.0
  • Odin v2.1.13

Reproduction steps

  1. Create new project.
  2. Import Xnode (in case it's worth mentioning, we import it through the package manager via repository URL).
  3. Import Odin. Ensure ODIN_INSPECTOR;ODIN_VALIDATOR are defined in the Scripting Define Symbols field in the player settings.
  4. Create the following test scripts:

Example Graph:

    using UnityEngine;
    using XNode;

    [CreateAssetMenu(fileName = "MyGraph", menuName = "Test/MyGraph", order = 1)]
    public class MyGraph : NodeGraph
    {
    }

Example Node:

using XNode;

public enum MyEnum
{
    Value1,
    Value2,
    Value3
}
public class MyNodeNode : Node
{
    public MyEnum myEnum;
}

  1. Now create a new graph instance: Asset > Create > Test > MyGraph.
  2. Open it in the graph visual editor and add a new node.
  3. Start changing the value in the node's My Enum field. image

After changing the value a couple of times Unity just crashes. Looking at the crash info in Unity's Editor log doesn't really offer any specific insight. It seems to be complaining about asset management operations.

PS: I keep mentioning enum fields but I'm not 100% sure that it's the only possible case. We use custom drop-downs for other properties and they seem to work fine in our nodes. PS2: We use Odin extensively across the whole project, so we can't really switch to the default implementation.

sp-tania-anta avatar Nov 19 '20 16:11 sp-tania-anta

I don't know if this is a related crash, but I can often crash the editor when renaming a node. This is on 2019.4.23f1 on Mac, Catalina, Metal. The crash appears to mention an alert that should not be displayed during a transaction:

'-[NSApplication runModalSession:] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)'

dmenefee avatar Mar 27 '21 00:03 dmenefee

Same for newer versions of Unity while making changes to types of ports on Arch Linux

XenuCode avatar Jun 13 '23 11:06 XenuCode