Unique Items without a Unique ID were duplicated for all clients

Description, details and error message(s)

Coherence Sync object marked as unique but nothing entered in the Manual Unique ID is replicated for all clients. Objects without a manually entered ID all get an automatically generated unique IDs at runtime but it is different for every client, so therefore not unique anymore.

Adding a unique ID fixed the issue of the replicated objects but it wasn’t clear I should add one. Maybe the Unique ID should be generated in the bake and not runtime? or an error could stop the bake completing if the unique ID is required.

Expected behaviour

Items marked as unique should not get replicated for each client. A warning/error should appear if the ID is not entered or an ID should be generated at bake time.

Environment

SDK: 1.0.5
Unity: 2022.3.9f
OS/Platform:
Developed on windows 10
Deployed to web

1 Like

Hey lucash, thank you for your message.

This is the intended behaviour, generating an id at bake time would mean only ever 1 instance of this prefab would be able to exist, and the unique id matters at runtime, not at editor time.

If you wish to control runtime uniqueness without a manually set ID at editor time, you should look into the CoherenceBridge.UniquenessManager API where you can register unique IDs at runtime to be used by the subsequent prefab instances you spawn.

1 Like

To add to what Miguel mentioned, you can find an example of that in action in our sample Campfire.

The “in action” part is thoroughly described on this page. Hope it helps!