Build Details

This example is a single script located at Assets/Plugins/Weaver/Procedural Assets/BuildDetailsScriptBuilder.cs. It implements an automated build numbering system which can be useful on its own, but also demonstrates how you can create your own Procedural Scripts.

  • The bare minimum required for a Procedural Asset is a field or property marked with an Asset Injection attribute and an appropriate generator method.
    • In this case, that's the Script property and GenerateScript method.
    • Unlike the Building example, the asset type here is MonoScript which means that the generator method needs to take a StringBuilder parameter instead of returning the asset type as shown in the Asset Generators table.
    • Since MonoScript is an editor-only type, the [ProceduralAsset] attribute automatically has EditorOnly set to true. The script is generated and gets compiled into a build like any other script, but the BuildDetailsScriptBuilder.Script property doesn't actually need to be assigned at runtime (and can't be because MonoScript doesn't exist at runtime).
  • The BuildDetailsScriptBuilder class inherits from SimpleScriptBuilder to utilise its ability to automatically gather the reflection FieldInfo of the existing fields. This allows it to easily get the existing BuildNumber and increment it when regenerating the script during a build.