Classes - RealityStop/Bolt.Addons.Community GitHub Wiki
ClassAsset
The ClassAsset lets you design C# classes directly inside Unity using Visual Scripting.
You can define fields, properties, methods, constructors, inheritance, and interfaces all visually, without writing code.
Features
- Inherit from existing classes or interfaces
- Define fields and properties
- Add methods and constructors
- Apply attributes to classes and members
- Generate complete C# classes ready for compilation
Getting Started
1. Create a ClassAsset
In the Project window:
Create → Visual Scripting → Community → Code → Class
2. Class Info
Setting | Description |
---|---|
Title | The name of the class. |
Category | The namespace where the class will be placed. |
Class Modifier | None , Abstract , Partial , Sealed , Static , or Static Partial . |
Attributes | Class-level attributes (e.g., [Serializable] ). |
3. Options
Option | Description |
---|---|
Serialized | Adds [Serializable] . |
Inspectable | Adds [Inspectable] . |
Include In Settings | Adds [IncludeInSettings(true)] . |
Flag for Defined Event Filtering | Marks this class for Defined Event nodes. |
ScriptableObject | Makes the class inherit from ScriptableObject . |
Inherits Type | Allows the class to inherit from another type. Unless ScriptableObject is enabled. |
Interfaces | Adds a list of interfaces to implement. |
Members
You can add constructors, fields, properties, and methods.
Constructors
Option | Description |
---|---|
Scope | Access modifier (e.g., public ). |
Initializer Type | Choose between None , Base or This . |
Parameters | Defines constructor parameters. |
Body Graph | Adds logic via FlowGraph. |
Example:
Fields & Properties
Option | Description |
---|---|
Scope | Access modifier (e.g., public , private ). |
Modifier | Optional modifier like static . |
Name | The field or property name. |
Type | The data type. |
Default Value | Optional default initializer. |
Attributes | Optional field or property attributes. |
Result:
Property Info
Option | Description |
---|---|
Getter / Setter FlowGraphs | Optional logic for custom get/set. |
Getter Scope | Access level for the getter. |
Setter Scope | Access level for the setter. |
Result:
Methods
Option | Description |
---|---|
Scope | Access modifier. |
Modifier | Optional method modifier. |
Name | The method name. |
Return Type | The return type (e.g., void , int ). |
Parameters | The list of input parameters. |
Body Graph | The FlowGraph used for logic. |
Attributes | Optional method attributes. |
Generics | (Experimental) Define generic type parameters. |
Result:
Logic Graphs
You can edit the logic of constructors, properties, and methods directly through their FlowGraphs.
Result:
Compilation
Compile your ClassAsset via the C# Preview window or
Addons → Compile Selected
.
This generates a ready-to-use C# class file.
✅ Example Result
📚 Advanced Features
Required Info
When inheriting a type, the Required Info section lists all members that must be implemented.
Overridable Members
Lists all properties and methods that can be overridden from the base type.
Member Units
A new CSharp section appears in the fuzzy finder, giving you units for:
- Inherited members
- Asset-defined members (
methods
,properties
,fields
) - The asset type (
typeof(CurrentAssetType)
)