Namespace Coherence.Toolkit
Namespaces
Classes
- CoherenceBridge
The
CoherenceBridge
is the component that all coherence entities use to communicate to the replication server, and other clients. It is also responsible for instantiating and destroying any remote entities that your client should know about.
- CoherenceClientConnection
This class is a base of a connection object used to mark an in-game presence and to send 'client messages'. To use the connection system:
* Create a prefab that has a CoherenceSync attached to it. This prefab must reside in the 'Resources' directory.
* Link prefab to the ClientConnectionPrefab field.
* (Optionally) You can use the ClientConnections's ProvidePrefab event for a fine grained control over objects instantiated for each connection.
* Make sure that the globalQueryOn is ticked.
The linked prefab will be instantiated for every new client connection. Since connection uses the global query those objects will be visible regardless of the in-simulation distance between the clients.
- CoherenceInput
This component can be added to a GameObject with CoherenceSync to be able to define which inputs it accepts.
This feature can be used to improve game feel and to prevent cheating by replaying inputs on a simulator or another client. See the coherence docs (section "Input prediction and rollback") for more information.
- CoherenceInputSimulation<TState>
CoherenceInputSimulation<TState> helps building a deterministic simulation by taking care of most complexities related to keeping a simulation state, handling predictions, rolling back state, resimulating state, etc..
- CoherenceLiveQuery
The live query is a component that filters what entities are replicated to the client based on their position in the world.
Use it by moving its transform to the center of interest and adjusting the radius to a suitable value. Using a small query is a great optimization if the world / room contains a lot of entities.
If set, the CoherenceBridgeResolver<T> event is used to decide which
CoherenceBridge
to use (in case there are multiple.)
- CoherenceNode
By default, coherence only supports direct parent-child parenting between two synced game objects. The
CoherenceNode
component can be used to lift this restriction and support placement into arbitrary deep hierarchies.Place this component on a GameObject to be able to parent it to any child transform of another game object and have that information be synchronized. Please note that a client needs to have authority over the child to be able to set its parent!
Note that both objects (parent and child) need to use CoherenceSync. They also need to be two different prefabs.
- CoherenceSync
Represents a coherence entity. Add this component to a
GameObject
and follow the instructions in the inspector to enable synchronization of it and its variables, sending commands to it, parenting, LODing, simulated inputs, and more.See the coherence documentation for tutorials, guides, and more information.
- CoherenceTagQuery
The tag query is a component that filters what entities are replicated to the client based on user-defined tags (strings.)
This query does not take position of entities into account, use CoherenceLiveQuery for that.
- CommandAttribute
Automatically add this method to the list of synced bindings in CoherenceSync. This makes the method available as a target for SendCommand.
Methods without this attribute can still be marked as viable targets for SendCommand by selecting them manually in the bindings configuration window.
- NonBindableAttribute
Attribute to skip types from being considered bindable.
- OnValueSyncedAttribute
Specifies a method to be called when the value of a synced field/property changes. This method will be called only for instances whose HasStateAuthority evaluates to false.
).
- SyncAttribute
Automatically add this member variable or property to the list of synced bindings in CoherenceSync.
Variables and properties without this attribute can still be synced by selecting them manually in the bindings configuration window.
Structs
- CoherenceInput.Field
An input definition, e.g. a single button. A
CoherenceInput
can have a collection of these.
Interfaces
Enums
- CoherenceInput.Field.Type
The type of the input.
- CoherenceSync.AuthorityTransferType
How this entity should respond to requests for authority (via RequestAuthority(AuthorityType)) by other clients.
- CoherenceSync.InterpolationLoop
At what point in the Unity update loop should interpolation happen.
- CoherenceSync.LifetimeType
What should happen to this entity after the client with authority over it disconnects or abandons it.
- CoherenceSync.OrphanedBehavior
How this entity should behave if it is abandoned by its client, e.g. if it disconnects and the entity is set to Persistent.
- CoherenceSync.SimulationType
How and where this entity is simulated.
- CoherenceSync.UniquenessType
Should this entity enforce that only a single instance with the same CoherenceUUID can exist at the same time.
Delegates
- CoherenceBridgeResolver<T>
Called by the Entity/Component to find the correct CoherenceBridge instance. The order of CoherenceBridge resolution is as follows:
* CoherenceBridge provided by the per-instance CoherenceBridgeResolver<T> callback
* CoherenceBridge provided by the global BridgeResolve callback
* CoherenceBridge within the same scene as this Entity/Component
* CoherenceBridge with a
checked * Creating new CoherenceBridge instance
- CoherenceSync.ConnectedEntityChangeHandler
The delegate type of ConnectedEntityChangeOverride.
- CoherenceSync.ConnectedEntitySentHandler
The delegate type of ConnectedEntityChangeOverride.
- CoherenceSync.OnAuthorityRequestedHandler
The delegate type of OnAuthorityRequested.