The Wiring system is a visual scripting system for connecting entities together to run logic and scripting, similar to other node scripting systems like Unreal Blueprints / Unity Playmaker
It uses the same variables and options as MBScript, but can useful for quickly making connections between Entities in a visual way. Wiring could be used to connect a Switch to a Door to open it ingame, while MBScript should be used to make reusable components / complex AI
Use the Wiring Tool, or open the Wiring Desktop Window. Select a Entity to start Wiring from it.
To trigger Actions (such as changing a variable), select the Events to run the Wiring on. You can also select Conditions that need to be True for the Wiring to happen.
Events can be Event variables (like 'Start' and 'Update'), or when a variable value changes (like it's Color or Scale), or when a method is run on a Entity (like 'Die')
On starting to Wiring a Entity to another one we select from the Components in the selected Entity, or the Entity it's Wired to.
In the above image the Lever is wiring to the Spin Joint - so it's showing Entity Components options that are in the Lever.
On hitting the + button beside "Actions" you can select to add a new action line:
- Set - Set a variable's value
- Do - Do a method / operation / or event
- Print - Print a value to the screen, useful for quick testing
These are the same as MBScript code lines.
- All MBScript variables and options are available to Wiring - including World Settings and all functions / members / extensions of a variable.
- Entities can also be Wired to themselves to change values and respond to events
- Wiring can also include 'local variables' like MBScript. New local variables can be set with the Local line
- The Create line spawns a new Entity, and shows it as a local variable. You can then set variables / do events on this new spawned Entity.
Here is a example of Wiring a Cube to itself, to change the color of Entities it collides with (if it collides with them at a speed greater than 1):
Here wiring is set to run on the 'On Collision' event on a Cube. The 'collisionInfo' is a local variable set by the collision event. It has a condition setting that it's collision speed must be above 4 - and if it is, then it sets the Color on the Entity it hit to Black.
- The Wiring data will be saved in the Entity it started with. So Prefabs made of that entity (or clones) will clone the Wiring data
Updated 2 months ago