Class CoherenceSyncConfigUtils
Utility class for CoherenceSyncConfig related operations.
public static class CoherenceSyncConfigUtils
- Inheritance
-
CoherenceSyncConfigUtils
Methods
CanLink(CoherenceSyncConfig)
Checks if an unlinked config can be linked.
public static bool CanLink(CoherenceSyncConfig config)
Parameters
config
CoherenceSyncConfig
Returns
Exceptions
- ArgumentNullException
When
config
is null.
Create(Object)
Create an CoherenceSync Config for the given Unity Object.
public static CoherenceSyncConfig Create(Object obj)
Parameters
obj
ObjectReference to the Unity Object that you want to create a CoherenceSync Config for.
Returns
- CoherenceSyncConfig
The created CoherenceSyncConfig, or the existing one.
Remarks
Only GameObjects with the CoherenceSync component attached are supported as CoherenceSync Objects at the moment.
CreateObjectInstantiator(CoherenceSyncConfig, Type)
Creates a new instance of a type implementing INetworkObjectInstantiator and assigns it to the given CoherenceSyncConfig.
public static void CreateObjectInstantiator(CoherenceSyncConfig config, Type type)
Parameters
config
CoherenceSyncConfigtype
Type
CreateObjectProvider(CoherenceSyncConfig, Type)
Creates a new instance of a type implementing INetworkObjectProvider and assigns it to the given CoherenceSyncConfig.
public static bool CreateObjectProvider(CoherenceSyncConfig config, Type type)
Parameters
config
CoherenceSyncConfigtype
Type
Returns
Delete(CoherenceSyncConfig)
Delete an existing CoherenceSyncConfig. If it's an asset, the asset will be deleted. This includes it being a subasset. If it's not an asset, it's destroyed.
Modifying several subassets on the same asset while on a batch (AssetDatabase.[Start|Stop]AssetEditing) will corrupt the asset.
public static bool Delete(CoherenceSyncConfig config)
Parameters
config
CoherenceSyncConfig
Returns
Link(CoherenceSyncConfig)
Attempt to link a CoherenceSyncConfig with its CoherenceSync counterpart.
public static bool Link(CoherenceSyncConfig config)
Parameters
config
CoherenceSyncConfigThe CoherenceSyncConfig to link.
Returns
Remarks
Linking tries to locate a CoherenceSync asset based on the ID. It also sets the CoherenceSyncConfig property on the CoherenceSync component.
Exceptions
- ArgumentNullException
When
config
is null.
- See Also
TryGetFromAsset(Object, out CoherenceSyncConfig)
public static bool TryGetFromAsset(Object obj, out CoherenceSyncConfig config)
Parameters
obj
Objectconfig
CoherenceSyncConfig
Returns
Events
OnAfterConfigCreated
Raised after the asset is created and initialized through Create(Object), but before registration on the CoherenceSyncConfigRegistry.
public static event Action<CoherenceSyncConfig> OnAfterConfigCreated
Event Type
OnBeforeConfigDeleted
Raised before a CoherenceSyncConfig asset is deleted through Delete(CoherenceSyncConfig).
public static event Action<CoherenceSyncConfig> OnBeforeConfigDeleted
Event Type
OnObjectInstantiatorChanged
Raised after Instantiator changes through a CreateObjectInstantiator(CoherenceSyncConfig, Type) call.
public static event Action<CoherenceSyncConfig, INetworkObjectInstantiator, INetworkObjectInstantiator> OnObjectInstantiatorChanged
Event Type
OnObjectProviderChanged
Raised after Provider changes through a CreateObjectProvider(CoherenceSyncConfig, Type) call.
public static event Action<CoherenceSyncConfig, INetworkObjectProvider, INetworkObjectProvider> OnObjectProviderChanged