Class SystemGraphComponent
Main monobehaviour component for sytem graph
Inherited Members
Namespace: Mechatronics.SystemGraph
Syntax
[ExecuteInEditMode]
[Serializable]
[HelpURL("https://docs.unity.cn/Packages/com.unity.systemgraph@2.0/manual/Architecture.html")]
public class SystemGraphComponent : MonoBehaviour
Constructors
SystemGraphComponent()
Initializes a new instance of the SystemGraphComponent class.
Declaration
public SystemGraphComponent()
Fields
_bindingsFoldOut
The bindings fold out for Inspector
Declaration
[SerializeField]
public bool _bindingsFoldOut
Field Value
| Type | Description |
|---|---|
| Boolean |
_graphReference
The graph reference used as an asset
Declaration
[SerializeField]
public SystemGraphObject _graphReference
Field Value
| Type | Description |
|---|---|
| SystemGraphObject |
_propertiesFoldOut
The properties fold out for Inspector
Declaration
[SerializeField]
public bool _propertiesFoldOut
Field Value
| Type | Description |
|---|---|
| Boolean |
Properties
ComponentManager
Contains data on all used properties and bindings for the current graph instance.
Declaration
public SystemComponentManager ComponentManager { get; }
Property Value
| Type | Description |
|---|---|
| SystemComponentManager | The component manager. |
DiagnosticsLog
Diagnostics Log
Declaration
public List<string> DiagnosticsLog { get; }
Property Value
| Type | Description |
|---|---|
| List<String> | The diagnostics log. |
ErrorsInTraceLog
Returns the state of errors in diagnostics log
Declaration
public bool ErrorsInTraceLog { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
GraphDescriptor
Descriptor that contains information about the current graph and all subgraphs.
Declaration
public SystemGraphManager.GraphDescriptor GraphDescriptor { get; }
Property Value
| Type | Description |
|---|---|
| SystemGraphManager.GraphDescriptor | The graph descriptor. |
GraphObject
The current runtime graph asset being used.
Declaration
public SystemGraphObject GraphObject { get; set; }
Property Value
| Type | Description |
|---|---|
| SystemGraphObject | The graph object. |
GraphObjectReference
Reference graph asset, this asset reference is copied and used for runtime. Any changes to this asset will not take place in the graph until a new Update(), upon which this component will replace the current runtime asset with the updated reference.
Declaration
public SystemGraphObject GraphObjectReference { get; set; }
Property Value
| Type | Description |
|---|---|
| SystemGraphObject | The graph object reference. |
InstanceGuid
GUID unique to every instance of SystemGraphComponent in the scene.
Declaration
public string InstanceGuid { get; }
Property Value
| Type | Description |
|---|---|
| String | The instance unique identifier. |
Linker
Gets the linker.
Declaration
public Linker Linker { get; }
Property Value
| Type | Description |
|---|---|
| Linker | The linker. |
LinkResult
Gets the link result.
Declaration
public Linker.LinkerResult LinkResult { get; }
Property Value
| Type | Description |
|---|---|
| Linker.LinkerResult | The link result. |
Scheduler
Gets the scheduler.
Declaration
public Scheduler Scheduler { get; }
Property Value
| Type | Description |
|---|---|
| Scheduler | The scheduler. |
Upgrading
Indicator for when the SystemGraph is undergoing an upgrade.
Declaration
public bool Upgrading { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
Methods
Awake()
Awake and assign new guid if necessary.
Declaration
public void Awake()
ClearDiagnosticsLog()
Clear Diagnostics Log
Declaration
public void ClearDiagnosticsLog()
ClearPendingGraphAssets()
Remove all pending graphs in the stack.
Declaration
public static void ClearPendingGraphAssets()
CreateRuntimeDescriptor(Boolean)
Creates all nodes and binds properties to nodes.
Declaration
public void CreateRuntimeDescriptor(bool forceRefresh = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | forceRefresh | Does nothing? for now. |
ForceValidate()
Check for reference asset diverging from current runtime asset, if so then update runtime asset.
Declaration
public void ForceValidate()
GetAllNodeRuntime()
Get a map of NodeGuid -> NodeDescriptor.
Declaration
public Dictionary<string, Linker.NodeReferenceDescriptor> GetAllNodeRuntime()
Returns
| Type | Description |
|---|---|
| Dictionary<String, Linker.NodeReferenceDescriptor> | Map of NodeGuid -> NodeDescriptor. |
GetBinding<T>(String)
This method can be used to retrieve the binding object by LynX path.
Declaration
public Binding<T> GetBinding<T>(string queryPath)
Parameters
| Type | Name | Description |
|---|---|---|
| String | queryPath | LynX path of the binding |
Returns
| Type | Description |
|---|---|
| Binding<T> | The binding of type binding{T} if queryPath exists, null otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the binding |
GetBindingValue<T>(String, out T)
This method can be used to get the binding value.
Declaration
public bool GetBindingValue<T>(string queryPath, out T data)
Parameters
| Type | Name | Description |
|---|---|---|
| String | queryPath | LynX query path of the binding |
| T | data | Data is written to this ref |
Returns
| Type | Description |
|---|---|
| Boolean | True if value was fetched successfully. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the binding |
GetComponentAttachments()
Get all the components used by this SystemGraphComponent. Components include properties and bindings.
Declaration
public ReadOnlyDictionary<string, IComponentAttachment> GetComponentAttachments()
Returns
| Type | Description |
|---|---|
| ReadOnlyDictionary<String, IComponentAttachment> | A map of Property/Binding name -> Monobehaviour component for all properties and bindings. |
GetNodeRuntime(String)
Find node in the current runtime asset by guid.
Declaration
public NodeRuntime GetNodeRuntime(string guid)
Parameters
| Type | Name | Description |
|---|---|---|
| String | guid | Guid to search for. |
Returns
| Type | Description |
|---|---|
| NodeRuntime | The appropriate NodeRuntime. |
GetProperty<T>(String)
This method can be used to retrieve the property object by name.
Declaration
public Property<T> GetProperty<T>(string propName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | propName | Name of the property |
Returns
| Type | Description |
|---|---|
| Property<T> | The property of type Property{T} if propName exists, null otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the property |
GetPropertyValue<T>(String, out T)
This method can be used to get the property value.
Declaration
public bool GetPropertyValue<T>(string propName, out T data)
Parameters
| Type | Name | Description |
|---|---|---|
| String | propName | Name of the property |
| T | data | Data is written to this ref |
Returns
| Type | Description |
|---|---|
| Boolean | True if value was fetched successfully. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the property |
Log(String)
General debug log. See LogError().
Declaration
public void Log(string msg)
Parameters
| Type | Name | Description |
|---|---|---|
| String | msg | Message to log. |
LogError(String)
Appends the graph name to the start of msg and logs error to console.
Declaration
public void LogError(string msg)
Parameters
| Type | Name | Description |
|---|---|---|
| String | msg | Message to log. |
LogWarning(String)
Logs warning, see LogError()
Declaration
public void LogWarning(string msg)
Parameters
| Type | Name | Description |
|---|---|---|
| String | msg | Message to log. |
OnDestroy()
Deregister this component from the manager of all system graphs.
Declaration
public void OnDestroy()
PushGraphAsset(SystemGraphComponent.PendingGraphDescriptor)
Add graph to the reference graph stack.
Declaration
public static void PushGraphAsset(SystemGraphComponent.PendingGraphDescriptor pendingGraphDesc)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemGraphComponent.PendingGraphDescriptor | pendingGraphDesc | See PendingGraphDescriptor. |
RefreshRuntimeParameters(Boolean, Boolean, Boolean)
Checks the current graph runtime graph asset against the reference graph asset. If the reference asset has changed, then updates the current runtime asset to match the reference asset. Then, Updates parameters and bindings to match the (possible) new asset.
Declaration
public void RefreshRuntimeParameters(bool forceRefreshGraph = false, bool forceRefreshComponents = false, bool preventComponentDeletion = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | forceRefreshGraph | Refresh the graph even if the reference asset hasn't changed. |
| Boolean | forceRefreshComponents | Refresh components, even if nothing is outdated. |
| Boolean | preventComponentDeletion | Do not delete any components when refreshing. |
SetBindingValue<T>(String, T)
This method can be used to set the binding value.
Declaration
public bool SetBindingValue<T>(string queryPath, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | queryPath | LynX path of the binding |
| T | value | Value to set |
Returns
| Type | Description |
|---|---|
| Boolean | The value of type Binding{T} if queryPath exists, null otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the binding |
SetPropertyValue<T>(String, T)
This method can be used to set the property value.
Declaration
public bool SetPropertyValue<T>(string propName, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | propName | Name of the property |
| T | value | Value to set |
Returns
| Type | Description |
|---|---|
| Boolean | The property of type Property{T} if propName exists, null otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the property |
Start()
Starts this instance.
Declaration
public void Start()