C# Generation - RealityStop/Bolt.Addons.Community GitHub Wiki

C# Generation

The C# Generation system allows you to design and compile fully functional C# code directly inside Unity using Visual Scripting.
Instead of writing code manually, you can visually construct classes, structs, interfaces, enums and their members and automatically generate valid C# source files.


Overview

The system bridges Unity Visual Scripting with actual C# code.
Every CodeAsset you create such as a ClassAsset, StructAsset, InterfaceAsset, EnumAsset or DelegateAsset represents a real C# type that can be compiled, saved, and used anywhere in your Unity project.

Note: You can compile ScriptGraphAsset's(Macro) and Scriptmachine's as well these will always compile as a Monobehaviour. Subgraphs will Generate as part of the flow that used it, these are not meant to be their own C# Scripts. C# Generation does not support any State functionality.

Once compiled, these generated types behave just like any other script:
they can be referenced, instantiated, and interacted with by both Visual Scripting and traditional C# scripts.


To Create an Asset
Choose the type of asset via
Create → Visual Scripting → Community → Code → ... In the project tab.