RealtimeView get by object id
Is there any way to get the same GameObject on 2 clients by an id?
RealtimeView reference at runtime using a UUID or an ID. The RealtimeView that are in the scene sometimes have a Scene View UUID, but this is used to synchronize the same view when the scene is loaded on multiple clients, not for retrieving RealtimeView references at runtime.RealtimeComponent that assigns a UUID in OnRealtimeModelReplaced() when getting a fresh model. This will ensure that the component has a unique UUID and that existing models don’t have their UUIDs reassigned by new clients. RealtimeView instances by UUID at runtime.MyModeluuidPropertyuuidPropertyuuidPropertypublic class MyComponent : RealtimeComponent<MyModel> {
private string _uuid;
protected override void OnRealtimeModelReplaced(MyModel previousModel, MyModel currentModel) {
if (currentModel.isFreshModel) {
_uuid = System.Guid.NewGuid().ToString();
currentModel.uuidProperty = _uuid;
} else {
_uuid = currentModel.uuidProperty;
}
}
}