Compiling Graphs

uNode comes with the auto c# code generation on build, this will make your game get the best performance by running it with native c# code instead of reflection.

uNode can also compile the graphs in Editor to get the best performance in Editor.

You can compile all Runtime Graphs into c# from menu:

Command Description
Generate C# Scripts Compile All Runtime Graph in the project.
Generate C# Scripts including Scenes Compile All Runtime Graph in the project including graphs in all Scenes.
( This will load each Scenes in Build Setting )
Delete Generated C# Scripts Remove All Runtime Graph Compiled Script in the projects.
( This should remove ‘uNode.Generated’ folder )

Or directly from uNode Editor for C# Graph and Runtime Graph:

Command Description
Compile Current Graph Compile the current opened graph.
( Only for C# Graphs )
Compile All C# Graph Compile All C# Graph in the project.
( Only for C# Graphs )
Compile Graphs ( Project ) Compile All Runtime Graph in the project.
Compile Graphs ( Project + Scenes) Compile All Runtime Graph in the project including graphs in all Scenes.
( This will load each Scenes in Build Setting )

 

And there’s 3 C# Code Generation options that you can change in preference:

  • Default
    Using individual graph setting, when the graph setting is also default this will be performed in Performance mode
  • Performance
    Generate pure c# and get the best result in term of performance but it may give errors when other graph is not compiled into script, the performance mode mean that the generated script is all pure c# so no more reflection system is used.
  • Compatibility
    Generate c# script that’s compatible with all graph even when other graph is not compiled into script, the compatibility mode will use a small of reflection system only to get / set the others graph data so if your graph don’t referencing others graph the generated script should be same as performance mode.
    There’s some graph that use this mode by default:
    -uNode Runtime
    -uNode Class / C# Graph
    -uNode Struct / C# Struct
    All those graph is using compatibility mode because it’s not guarantee that the referenced of the other graph has been compiled and it’s because those graph can be individually compiled into script.

 

Note:

  • All of C# Graphs can only be compiled manually from ‘uNode Editor > Compile‘ button.
  • All of Runtime Graphs are compiled automatically on Build except:
    • Uncheck ‘Compile to C#‘ from individual graph
    • Uncheck ‘Auto Generate on Build‘ from preference setting
  • After compiling graphs, you must recompile again after making any changes, or remove the graphs to instead use reflection again.
Was this helpful to you?