Search Unity

Bug Graph becomes empty after a custom node compilation error

Discussion in 'Visual Scripting' started by kakyounity, Jun 14, 2022.

  1. kakyounity

    kakyounity

    Joined:
    Apr 18, 2012
    Posts:
    4
    My environment

    Unity: 2021.3.2f1
    UVS: 1.7.8
    OS: macOS 12.4.

    I'm evaluating UVS to see if building workflows using custom nodes is a viable solution. But I'm hit with an annoying issue:

    1. Create a GameObject, add a Script Machine and attach a Script Graph to it.
    2. Create a custom node that compiles fine and shows up correctly in the above Graph.
    3. Build a simple graph with the custom node, such as OnStartEvent => MyNode.
    4. Edit the node's C# script a bit to make it break during compilation.
    5. Quit Unity and reopen the project, select Ignore to force open with the compilation error present.
    6. Fix the script and make it compile.
    7. Find the Graph and activate it.
    8. Now the Graph is completely empty!
    No refreshing could fix it while Unity is open the entire time.
    The workaround I found is to quit Unity and reopen the project once again after Step 6 above, and then the Graph works again.

    Another more serious trouble: After I rename the custom node class from MyNode to MyOtherNode, then this time the Graph becomes empty and completely unrecoverable over a deserialization error! I tried all the reopening/refreshing tricks and also tried regenerating the nodes from Project Settings, but no effect.

    This looks like a showstopper to me.

    Is this by design or am I missing anything obvious?
    For one, I've never found a way to explicitly save/export the graphs through the Editor UI, other than creating the Graph as an asset in the Project window. However, the Graph is always correctly loaded after a clean close-and-reopening cycle if no errors are in my custom node script.
     
    Last edited: Jun 14, 2022
    Mykola_Khimich likes this.
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,072
    Yes, the tool was never designed with a custom node workflow in mind. It was marketed purely at Unity/coding newbies and didn't even have its custom node API documented before Unity acquired it. Hence the issues.

    They're redesigning the tool from the ground up for Unity 2023. In the meantime, I wouldn't expect for things to improve in this regard.
     
  3. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    Mykola_Khimich likes this.
  4. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    398
    You can rename the custom node directly in the serialised file. Also use RenamedFrom attributes in your code. Although i prefer the first option. When you rename then it no longer exists, yet your graph refers to it.
     
    myanko likes this.
  5. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    Sorry for the long delay. I was able to test the fix with the removal of a script, with a node renamed with the Attribute
    [RenamedFrom("MyNode")] on top of the class. Pretty much all use cases should be fine when the fix is pushed.