Functions\Extensions

  • [MBFunction] attribute can be used on static methods to have them as Function options in MBScript

  • 'MBFunctionForType' attribute can be used to set it to show under another type

  • Static C# methods can be exposed as Extensions for MBScriptMBScript - MBScript is the visual scripting system for creating new Components on Entities / WiringWiring - The Wiring system is a way to do simple logic based on Entity properties, using the same variables and options as MBScript, where the first Parameter type is then what it's a extension for (like C# extension methods)

[MBExtension]
static int Length(string Text)
{
    if (Text == null)
        return 0;
    return Text.Length;
}

[MBFunctionQuickOption]
[MBFunctionForType(typeof(string))]
static string NewLine()
{
    return System.Environment.NewLine;
}
  • The 'NewLine' can then be used in MBScript like: Func.String.NewLine

  • The 'Length' extension can be used on any value returning a string. Like 'Name.Length'