Auto-create Custom Actions
- Enter Agent Mode
- Prompt: describe the Action you want, it’s goal, and tell Bezi to create an Action. Be specific with inputs, outputs, side effects, read-only, and approval requirements
- Bezi will use the dedicated skill to write the Custom Action to the codebase
- Check the thread’s diff to review the Custom Action code
- Use the Custom Action!
Create a read-only action that takes an assets folder path and returns the number of prefabs in it.
Convert DeleteGeneratedPrefabs in @PrefabTools.cs into a custom action that requires approval.
Manually create a Custom Action
If you prefer to build Custom Actions in C#, add the[BeziAction] attribute to a static method in an Editor assembly, and provide the required parameters.
BeziActionAttribute API
[BeziAction] can be synchronous or async, with any serializable inputs and outputs. Invalid inputs throw an exception and instructions for Bezi to recover from the error. You can customize the attribute with the following parameters:
Best Practices
Structured return values
Return a serializable class, struct, or tuple when the Action needs to return more than one result.Validate inputs, throw useful exceptions, and use Undo patterns
Validate inputs and the current state of the project upfront as much as possible. Throw an exception with a useful message early in the Custom Action so Bezi knows what went wrong and how to proceed. Since Bezi creates an undo group for each batch of Actions, you can use Unity’s typicalUndo patterns to hook into the undo group and allow the Custom Action to use the undo menu or shortcuts.
Prefer returning data instead of logging
Logs written to the Unity console viaDebug.Log methods are not directly available to Bezi without extra tool calls. Make sure to provide any useful information from the Custom Action as a return value.
Troubleshooting
Bezi can’t find the Custom Action
Wait for Unity to compile (as well as theGenerating type definitions... background task), fix any Console errors, and confirm the method is public, static, non-generic, and part of an Editor assembly.
The Custom Action isn’tavailable in Ask or Plan Mode
Custom Actions must be markedIsReadOnly = true to run in Ask or Plan Mode. Use Agent Mode for Actions which require modifying state.