Class GlobalContext<TEnum>
Abstract base class for activatable platform nodes (mutable contexts). Extend this class to create a context that can be changed at runtime via Activate(Enum).
Simple contexts with no side effects need no overrides:
public class MyContext : GlobalContext<MyEnum> { }
Implements
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
public abstract class GlobalContext<TEnum> : IPlatformNode where TEnum : struct, Enum
Type Parameters
| Name | Description |
|---|---|
| TEnum | The flags enum type representing the context values. |
Remarks
Contexts with custom activation logic override Activate(Enum) and optionally Current:
Examples
public class MyContext : GlobalContext<MyEnum>
{
public override Enum Current => ComputeState();
public override void Activate(Enum value) { /* custom logic */ }
}
Properties
Build
Retrieves the current build platform state at any given time. This will be used to determine which platform state to build for if this node is used.
Declaration
public virtual Enum Build { get; }
Property Value
| Type | Description |
|---|---|
| Enum |
Current
Retrieves the current platform state at any given time. This will be used to determine the current platform state if this node is used.
Declaration
public virtual Enum Current { get; }
Property Value
| Type | Description |
|---|---|
| Enum |
DataType
The data type that this node will use. This must be an Enum type.
Declaration
public Type DataType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Methods
Activate(Enum)
Activates the given context value. Override in mutable context nodes (via GlobalContext<TEnum>) to change platform state at runtime. Read-only nodes should not override this method.
Declaration
public virtual void Activate(Enum value)
Parameters
| Type | Name | Description |
|---|---|---|
| Enum | value | The enum value to activate. |