You can add Variables to the MBScript code which will then show in the Entity properties.
To add variables in MBScript, use the '+' button or the 'Add' dropdown at the top and select 'Add Variable'. You then select the variable type.
Variable types that have a value (like Number, Text, 'Entity', 'Entity Asset') can have a Default Value set (which will be the starting value when the MBScript is added to a Entity).
- Basic types like Bool (True/False), Number, Text
- All Assets types, like Entity Assets, Materials, Audioclips, etc
- Vectors, Range (with a min / max number)
- Entity: for a Entity in the world
Some variable types are made from multiple other types. If ‘Entity Component of X type’ is selected, you then select the type of Entity Component. This could be a component on a Entity like Transform / Health System, or could be another MBScript
Methods can be added that other scripts can call. They can have parameters set to pass values.
ReturnMethod are methods that return a value.
Added variables can also include new Events. Events can be called in the same script or in other entities.
Events are used to have any other MBScript code run when it's called - rather than just specific code like Methods.
If ‘Event(x)’ is selected, then an event variable with a parameter type is added (with the ‘x’ meaning you then select the parameter type). That way the Event can be called passing a value
When creating a variable type with a value there is a option to 'Create as List'.
If a variable is a List it'll show borders on the side of the icon.
PlayTime variables store the current 'play mode time': seconds since play mode started.
Each PlayTime variable also has a event added for when it's 'Lapsed'. Which can be a useful way to run code after a set amount of time / on a specific time loop
Updated 6 months ago