Marlon Stein
Marlon Stein
NNormal
Created by Marlon Stein on 10/14/2024 in #🤝ask-a-question
isOwnedLocallySelf during Start()
I've made a script for setting and syncing a unique ID for my objects; I am generating the UUID and setting it to the model during the Start() function here:
private void Start()
{
if (realtimeView.isOwnedLocallySelf)
{
GenerateAndSetNewUuid();
}
else
{
model.theStringDidChange += OnUUIDUpdated;
}
}
private void Start()
{
if (realtimeView.isOwnedLocallySelf)
{
GenerateAndSetNewUuid();
}
else
{
model.theStringDidChange += OnUUIDUpdated;
}
}
but according to my logs both clients end up calling GenerateAndSetNewUuid()? Is it possible that both clients think they own the object during the Start method? What would be a workaround to this to make sure only one clients tries to set the Uuid and ensures the other clients try to Update the UUID once the first client sets it?
10 replies