Class PolySpatialStateValidator
This class is used to fetch and compare state between clientSim and hostPlatform layer GameObjects. A collection of tracked GameObjects are retrieved from the hostPlatform layer. The clientSim layer GameObjects is compared against the hostPlatform layer GameObjects, checking components and their properties, and generating diff String. There are 2 main components to this class:
- GameObject State Retrieval - when invoked, retrieves all supported GameObject and GameObject component properties to generate 2 GameObjectNode collections (for clientSim and hostPlatform layers).
- Diff String Generator - when invoked, compares collection of GameObjectNodes and generates a diff String for all non-matching values. Note that comparisons may not always be 1-1 as some conversion and rounding is expected in PolySpatial hostPlatform GameObjects. There are 3 facets of development to this class:
- Supporting additional GameObject components and properties - currently a subset of all PolySpatial supported components are tracked and validated. The current goal is to support all components tracked via PolySpatial tracker classes.
- Extend component property validation - Some supported components may not fully validate all component properties, or validations are high level only (checking only for the presence of the component, not comparing values).
- Supporting additional platforms - currently only UnityPolySpatialNativePlatform is supported
There are known issues with certain component properties that generate diffs which should be tracked by a JIRA (a JIRA link should be included above the relevant lines of code). If missing, please add a JIRA or reach out to the PolySpatial QA and/or PolySpatial Core team.
Inherited Members
Namespace: Global Namespace
Syntax
public class PolySpatialStateValidator
Constructors
PolySpatialStateValidator(Boolean)
Declaration
public PolySpatialStateValidator(bool enableExtraValidation = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | enableExtraValidation |
Fields
s_MarkedForDestroy
Declaration
public static List<string> s_MarkedForDestroy
Field Value
Type | Description |
---|---|
List<String> |
Methods
ClientSimChangeDetected(Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode>, Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode>)
Compares 2 clientSim state collections to determine if a change is present between the states. Though similar to clientSim to hostPlatform state comparison, this alternative method is needed as there are no expected component conversions between clientSim-clientSim state comparisons, whereas clientSim-hostPlatform state comparison expects conversions among other known diffs.
Declaration
public bool ClientSimChangeDetected(Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> previousClientSimState, Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> currentClientSimState)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> | previousClientSimState | A previously generated clientSim state dictionary |
Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> | currentClientSimState | The current clientSim state dictionary |
Returns
Type | Description |
---|---|
Boolean | true if a change is detected between the 2 state dictionaries, false otherwise |
DestroyState(Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode>)
Destroys the cloned assets in the specified state map and clears it.
Declaration
public static void DestroyState(Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> state)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> | state | collection of all PolySpatialInstanceIds and GameObjectNodes (can be null, in which case this is a no-op) |
GenerateStateDiff(Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode>, Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode>)
Declaration
public StringBuilder GenerateStateDiff(Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> clientSimState, Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> hostPlatformState)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> | clientSimState | |
Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> | hostPlatformState |
Returns
Type | Description |
---|---|
StringBuilder |
GetState(out Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode>, out Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode>, out List<Object>, out List<Object>)
Returns the current state of ClientSim and HostPlatform GameObject data, mapping their QIDs to GameObject data encapsulated in GameObjectNode instances. Each collection of entries represents found GameObjects in their respective (clientSim or PolySpatial/HostPlatform) layer. Also fetches any unregistered assets found for each layer.
Declaration
public void GetState(out Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> clientSimState, out Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> hostPlatformState, out List<Object> unregisteredClientSimAssets, out List<Object> unregisteredHostPlatformAssets)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> | clientSimState | collection of all clientSim layer PolySpatialInstanceIds and GameObjectNodes found |
Dictionary<PolySpatialInstanceID, PolySpatialStateValidator.GameObjectNode> | hostPlatformState | collection of all hostPlatform layer PolySpatialInstanceIds and GameObjectNodes found. Note that hostPlatform layer state dictionary is still indexed by clientSim GO PolySpatialInstanceIds. |
List<Object> | unregisteredClientSimAssets | collection of all unregistered clientSim Assets found |
List<Object> | unregisteredHostPlatformAssets | collection of all unregistered hostPlatform Assets found |