Class RuntimeProfile
The Runtime Profile manages Options and their initial values when playing the project in the editor or in a build.
Inheritance
Namespace: sttz.Trimmer
Assembly: Trimmer.dll
Syntax
public class RuntimeProfile : IEnumerable<Option>, IEnumerable
Remarks
The profile can be enumerated to access the individual Options.
In case no Options are included in a build, Trimmer will be completely
removed and the RuntimeProfile class will not be available in builds. Use
the NO_TRIMMER
compilation symbol to check if Trimmer will be removed.
Constructors
| Improve this Doc View SourceRuntimeProfile()
Create a new profile without any defaults.
Declaration
public RuntimeProfile()
RuntimeProfile(ValueStore)
Create a new profile with given defaults.
Declaration
public RuntimeProfile(ValueStore store)
Parameters
Type | Name | Description |
---|---|---|
ValueStore | store |
Fields
| Improve this Doc View Sourceoptions
Options sorted by ApplyOrder.
Declaration
protected List<Option> options
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Option> |
optionsByName
Options by name.
Declaration
protected Dictionary<string, Option> optionsByName
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, Option> |
TRIMMER_VERSION
Current version of the Trimmer framework.
Declaration
public static readonly Version TRIMMER_VERSION
Field Value
Type | Description |
---|---|
Version |
Properties
| Improve this Doc View SourceAllOptionTypes
All available Options types.
Declaration
public static IEnumerable<Type> AllOptionTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> |
Remarks
This property will include all Options in the editor but only the included Options in builds.
Main
Main runtime profile.
Declaration
public static RuntimeProfile Main { get; protected set; }
Property Value
Type | Description |
---|---|
RuntimeProfile |
Remarks
The main runtime profile is available while playing in the editor, during building when post-processing scenes and in the player if any Options have been included.
Store
Values used for this profile.
Declaration
public virtual ValueStore Store { get; set; }
Property Value
Type | Description |
---|---|
ValueStore |
Remarks
Setting the store causes all Options' value to be reset to the values from the store, Options for which no value is defined in the store are reset to their default value. Setting the store will not apply the Options.
Methods
| Improve this Doc View SourceApply()
Apply the profile, i.e. apply all Options it contains.
Declaration
public void Apply()
CleanStore()
Remove all entries from the store that don't have a matching Option instance.
Declaration
public void CleanStore()
CleanStoreRecursive(ValueStore.Node, Option, Boolean)
Declaration
protected void CleanStoreRecursive(ValueStore.Node node, Option option, bool isDefaultNode = false)
Parameters
Type | Name | Description |
---|---|---|
ValueStore.Node | node | |
Option | option | |
System.Boolean | isDefaultNode |
Clear()
Clear the profile, resetting all Options to their default values.
Declaration
public void Clear()
CreateMain(ValueStore)
Create the main runtime profile with the given value store.
Declaration
public static void CreateMain(ValueStore store)
Parameters
Type | Name | Description |
---|---|---|
ValueStore | store |
Remarks
This method is automatically called by BuildManager and ProfileContainer and should not be called manually.
GetEnumerator()
Declaration
public IEnumerator<Option> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<Option> |
GetOption(String)
Try to find an option by its path, allowing to get nested child and variant options.
Declaration
public Option GetOption(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path |
Returns
Type | Description |
---|---|
Option |
Remarks
Use Path to get the path of an existing Option that can then be used with this method.
GetRootOption(String)
Get a main Option by name (no nested child or variant Options).
Declaration
public Option GetRootOption(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
Option |
Load()
Load the data in the store into the Option instances.
Declaration
public void Load()
ParseParameter(ref String, out String)
Declaration
protected void ParseParameter(ref string part, out string parameter)
Parameters
Type | Name | Description |
---|---|---|
System.String | part | |
System.String | parameter |
SaveToStore(Boolean)
Save the Options' current values to the store.
Declaration
public void SaveToStore(bool clear = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | clear |
Remarks
The store will be cleared of all entries with no matching Option instance.
ShouldCreateOption(Type)
Limit the Options the profile creates.
Declaration
protected virtual bool ShouldCreateOption(Type optionType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | optionType |
Returns
Type | Description |
---|---|
System.Boolean |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |