How to access Build Information or Asset Settings in code?

Accessing the info or options

You can access the info or options assets both in editor and at runtime. Below is how you achieve this for both assets:


Editor Access

In the editor, you can access both via the BuildVersionsEditorUtil class. Which contains properties for Build Information & Build Options to access both assets:

public void ExampleMethod()
{
    var info = UtilEditor.BuildInformation;
}

Runtime Access

At runtime you need to use the AssetAccessor helper class and get the relevant asset via the GetAsset<T>() method like so:

public void ExampleMethod()
{
    var info = AssetAccessor.GetAsset<BuildInformation>();
}