Class ProfileContainer
Container for the Runtime Profile.
Inheritance
Namespace: sttz.Trimmer
Assembly: Trimmer.dll
Syntax
public class ProfileContainer : MonoBehaviour
Remarks
For the player, we need to get the ValueStore of the Build
Profile, containing all the Option values, into the build. We use this
container MonoBehaviour
to contain the store and inject it into
the build's scene using BuildManager and
IProcessScene.
The container also provides an API to inject additional Unity objects into the build.
Fields
| Improve this Doc View Sourcestore
Field for the store which Unity will serialize in the build.
Declaration
public ValueStore store
Field Value
Type | Description |
---|---|
ValueStore |
Properties
| Improve this Doc View SourceInstance
The shared instance of the profile container.
Declaration
public static ProfileContainer Instance { get; set; }
Property Value
Type | Description |
---|---|
ProfileContainer |
Remarks
This instance is set in the player but not when playing in the editor.
During build, the shared instance is also set when building the first scene (to add references to the build) but not when building subsequent scenes.
To access the runtime profile, use Main.
Methods
| Improve this Doc View SourceAddReference(String, Object)
Add an Unity object reference to be included in the build.
Declaration
public void AddReference(string guid, Object reference)
Parameters
Type | Name | Description |
---|---|---|
System.String | guid | |
UnityEngine.Object | reference |
Remarks
This method can be called during the PostprocessScene(Scene, OptionInclusion) callback
of the first scene (scene.buildIndex
is 0) to add Unity object references
that can then be recalled in the build using GetReference<T>(String).
GetReference<T>(String)
Get a Unity object reference in the build.
Declaration
public T GetReference<T>(string guid)
where T : Object
Parameters
Type | Name | Description |
---|---|---|
System.String | guid |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Remarks
The reference needs to have been added using AddReference(String, Object) during the build.