Predicted Hierarchy
The Predicted Hierarchy
system provides a set of methods for dynamically creating, deleting, and managing objects within the simulation. These methods allow developers to interact with the hierarchy in a way that feels natural and Unity-like, while ensuring that all changes are predictable and synchronized with the server.
Key Methods
Object Creation:
Create
Methods:Instantiates objects in the simulation.
Supports creating objects from prefab IDs or
GameObject
references.Optionally allows specifying position and rotation.
Returns a
PredictedObjectID
to uniquely identify the created object.
TryCreate
Methods:Attempts to create an object and returns a boolean indicating success.
Outputs the
PredictedObjectID
of the created object.Fails if prefab id is invalid or prefab isn't part of the registered prefab list.
Object Deletion:
Delete
Methods:Removes objects from the simulation using their
PredictedObjectID
.Handles both pooled and non-pooled objects.
Object Retrieval:
GetGameObject
:Retrieves the
GameObject
associated with aPredictedObjectID
.
GetComponent
:Retrieves a specific component from the
GameObject
associated with aPredictedObjectID
.
TryGetId
:Retrieves the
PredictedObjectID
associated with aGameObject
.
TryGetGameObject
:Retrieves the
GameObject
associated with aPredictedObjectID
and returns a boolean indicating success.
Last updated