Class ConfigurationManager
The configurator has two main functions:
Inherited Members
Namespace: UnityEngine.Industrial.Configuring.ConfiguratorRuntime
Syntax
[ExecuteInEditMode]
public class ConfigurationManager : MonoBehaviour
Properties
configurator
Configurator to which the configuration manager belongs (must be the parent in the hierarchy).
Declaration
public Configurator configurator { get; }
Property Value
Type | Description |
---|---|
Configurator | The configurator. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The ConfigurationManager must be child to a GameObject with a Configurator component. |
currentConfiguration
Current configuration.
Declaration
public IReadOnlyConfiguration currentConfiguration { get; }
Property Value
Type | Description |
---|---|
IReadOnlyConfiguration | The current configuration. |
Remarks
The current configuration is not necessarily already applied. Use Switcher to apply a configuration.
currentConfigurationInternal
Gets the current configuration internal.
Declaration
public Configuration currentConfigurationInternal { get; }
Property Value
Type | Description |
---|---|
Configuration | The current configuration internal. |
currentProduct
Current product.
Declaration
public Product currentProduct { get; }
Property Value
Type | Description |
---|---|
Product | The current product. |
currentProductIndex
Current product index.
Declaration
public int currentProductIndex { get; }
Property Value
Type | Description |
---|---|
Int32 | The index of the current product. |
products
Gets the products.
Declaration
public ProductRepository products { get; }
Property Value
Type | Description |
---|---|
ProductRepository | The products. |
Methods
ApplyDefaultConfiguration()
Applies the default configuration.
Declaration
public void ApplyDefaultConfiguration()
ApplyVerifiedConfigurationChange(VerifiedConfigurationChange)
Applies the given verified configuration change to the current configuration and switches it in the variant table.
Declaration
public void ApplyVerifiedConfigurationChange(VerifiedConfigurationChange verifiedConfigurationChange)
Parameters
Type | Name | Description |
---|---|---|
VerifiedConfigurationChange | verifiedConfigurationChange | The verified configuration change. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The configuration change must not be null. |
ArgumentException | The configuration change is not referencing the current configuration. |
ArgumentException | The configuration change is already stale: the current configuration has already change since the configuration change has been created. |
ArgumentException | The configuration change must not be null. |
ArgumentException | The configuration change is not referencing the current configuration. |
Awake()
Awakes this instance.
Declaration
public void Awake()
GetCurrentDefaultConfiguration()
Get the current configuration based on the current context.
Declaration
public Configuration GetCurrentDefaultConfiguration()
Returns
Type | Description |
---|---|
Configuration | Configuration. |
IsLoading()
Determines whether this instance is loading.
Declaration
public bool IsLoading()
Returns
Type | Description |
---|---|
Boolean |
|
LoadProduct(Int32)
Loads the product.
Declaration
public AsyncOperationHandle<GameObject> LoadProduct(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | AsyncOperationHandle<GameObject>. |
OnValidate()
Called when [validate].
Declaration
public void OnValidate()
ProcessConfigurationOperation(ProviderOperation<RuleEngineReply>, Action<RuleEngineReply>)
Processes the configuration operation.
Declaration
public void ProcessConfigurationOperation(ProviderOperation<RuleEngineReply> configChangeOperation, Action<RuleEngineReply> callback = null)
Parameters
Type | Name | Description |
---|---|---|
ProviderOperation<RuleEngineReply> | configChangeOperation | The configuration change operation. |
Action<RuleEngineReply> | callback | The callback. |
ProcessConfigurationReply(RuleEngineReply, Action<RuleEngineReply>)
Processes the configuration reply.
Declaration
public void ProcessConfigurationReply(RuleEngineReply reply, Action<RuleEngineReply> callback = null)
Parameters
Type | Name | Description |
---|---|---|
RuleEngineReply | reply | The reply. |
Action<RuleEngineReply> | callback | The callback. |
QueryConfigurationChangeValidity(ConfigurationChange)
Verifies a configuration change (asynchronously), the change is validated against the configuration which the configuration change references.
Declaration
public ProviderOperation<RuleEngineReply> QueryConfigurationChangeValidity(ConfigurationChange configurationChange)
Parameters
Type | Name | Description |
---|---|---|
ConfigurationChange | configurationChange | The configuration change. |
Returns
Type | Description |
---|---|
ProviderOperation<RuleEngineReply> | ProviderOperation<RuleEngineReply>. |
Remarks
This is an asynchronous call that returns a handle of type IAsyncOperation{RuleEngineReply}. For some implementations, it may be that the call is effectively synchronous and the handle already contains the result. Check if IAsyncOperation{T}.isDone is
true
after calling
this method if this is the case.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Configuration change must not be null. |
InvalidOperationException | There is no produced loaded. |
InvalidOperationException | There is no rule engine, cannot check validity of configuration change. |
InvalidOperationException | There is currently no context, cannot check validity of configuration change. |
InvalidOperationException | Configuration change must not be null. |
InvalidOperationException | There is no produced loaded. |
InvalidOperationException | There is no rule engine, cannot check validity of configuration change. |
InvalidOperationException | There is currently no context, cannot check validity of configuration change. |
QueryDefaultConfigurationValidity()
Verifies the default configuration belonging to the current context (asynchronously).
Declaration
public ProviderOperation<RuleEngineReply> QueryDefaultConfigurationValidity()
Returns
Type | Description |
---|---|
ProviderOperation<RuleEngineReply> | ProviderOperation<RuleEngineReply>. |
Remarks
This is an asynchronous call that returns a handle of type IAsyncOperation{RuleEngineReply}. For some implementations, it may be that the call is effectively synchronous and the handle already contains the result. Check if IAsyncOperation{T}.isDone is
true
after calling
this method if this is the case.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The current configuration is not empty: cannot apply default configuration. |
InvalidOperationException | There must be a context to apply the default configuration. |
InvalidOperationException | There is no produced loaded. |
InvalidOperationException | The current configuration is not empty: cannot apply default configuration. |
InvalidOperationException | There must be a context to apply the default configuration. |
InvalidOperationException | There is no produced loaded. |
InvalidOperationException | The current configuration is not empty: cannot apply default configuration. |
SwitchProduct(Int32)
Unloads the current product (destroys it) and loads the product with the given index.
Declaration
public AsyncOperationHandle<GameObject> SwitchProduct(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | AsyncOperationHandle<GameObject>. |
SwitchProductAndApplyDefaultConfiguration(Int32)
Unloads the current product (destroys it) and loads the product with the given index.
Declaration
public AsyncOperationHandle<GameObject> SwitchProductAndApplyDefaultConfiguration(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | AsyncOperationHandle<GameObject>. |
UnloadCurrentProduct()
Unloads the current product.
Declaration
public void UnloadCurrentProduct()
Events
configurationApplied
Raised when a configuration change has been applied to the variant table and all assignments have been switched.
Declaration
public event ConfigurationAppliedHandler configurationApplied
Event Type
Type | Description |
---|---|
ConfigurationAppliedHandler |