custom sync question
what is this for and is it required to have it in your script?
protected override void OnRealtimeModelReplaced(ColorSyncModel previousModel, ColorSyncModel currentModel) {
if (previousModel != null) {
// Unregister from events
previousModel.colorDidChange -= ColorDidChange;
}
if (currentModel != null) {
// If this is a model that has no data set on it, populate it with the current mesh renderer color.
if (currentModel.isFreshModel)
currentModel.color = _meshRenderer.material.color;
// Update the mesh render to match the new model
UpdateMeshRendererColor();
// Register for events so we'll know if the color changes later
currentModel.colorDidChange += ColorDidChange;
}
}protected override void OnRealtimeModelReplaced(ColorSyncModel previousModel, ColorSyncModel currentModel) {
if (previousModel != null) {
// Unregister from events
previousModel.colorDidChange -= ColorDidChange;
}
if (currentModel != null) {
// If this is a model that has no data set on it, populate it with the current mesh renderer color.
if (currentModel.isFreshModel)
currentModel.color = _meshRenderer.material.color;
// Update the mesh render to match the new model
UpdateMeshRendererColor();
// Register for events so we'll know if the color changes later
currentModel.colorDidChange += ColorDidChange;
}
}