RonJames
RonJames2w ago

Ownership and Synchronized data

So my current setup uses a realtime avatar manager which spawns in player prefabs which all have a realtime model on them which stores player specific information that needs to sync like player user name. I'm a little confused about how the authority works in this situation. Does the player have full authority over their own prefba and what does this entail? my assumption and current understanding is that remote players shouldn't be able to edit their model data. also, if I have multiple instances of a realtimecomponent with a model, is that sync data unique for each instance? I'm having an issue where I'm rendering the list of players in the room and it keeps duplicating names where it shouldn't so i'm trying to work out how this might be happening.
4 Replies
kapa.ai
kapa.ai2w ago
Hi @RonJames. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Your understanding is mostly correct, and I’ll clarify how authority and data synchronization work in Normcore, especially in the context of player prefabs and RealtimeModels. Authority and Ownership - Player Authority: When you instantiate a player prefab (e.g., via Realtime.Instantiate() with ownedByClient: true), the local client becomes the owner of the root RealtimeView on that prefab. This means only the owning client can modify the data in the RealtimeModel attached to their own prefab. Remote clients cannot edit another player's model data—ownership is enforced by the server, and any modification attempts from non-owners are rejected or rolled back automatically. This is intentional and is the recommended approach for player avatars and their data, such as usernames or other player-specific info.
Ownership + Lifetime Flags
RealtimeView Reference - What Ownership Entails: Ownership of a RealtimeView means the owner can modify any child RealtimeComponent or RealtimeModel under that view. Other clients are blocked from making changes to those models or components. This ensures that, for example, only the local player can update their username or avatar state, and other clients can only observe those changes, not make them. Synchronized Data and Uniqueness - Unique Data per Instance: Each instance of a RealtimeComponent with its own RealtimeModel has unique synchronized data. When you spawn multiple player prefabs, each prefab (and its components/models) is tracked separately in the datastore. The data for each player (like their username) should be unique to their instance and not shared across prefabs.
RealtimeComponent - Duplication Issue: If you’re seeing duplicated names in your player list, it’s likely not an issue with Normcore’s synchronization itself, but rather with how you’re managing or rendering the list. Possible causes include: - Accidentally reusing the same model instance for multiple players. - Not properly clearing or updating your UI list when players join/leave. - Instantiating prefabs incorrectly (e.g., using Unity’s Instantiate() instead of Realtime.Instantiate()), which can break the model/component linkage and cause unexpected behavior.
Common Questions: RealtimeComponents Troubleshooting Tips - Ensure you use Realtime.Instantiate() for all networked prefabs. - Each player prefab should have its own RealtimeView and RealtimeModel instances. - When rendering the player list, make sure you’re iterating over the correct set of unique player models. - Double-check that you’re not accidentally sharing model references between prefabs. If you follow these patterns, each player should have authority over their own data, and the data should remain unique per instance. If duplication persists, review your player list rendering logic and prefab instantiation code. If you need more specific debugging help, feel free to share code snippets or more details about how you’re managing and displaying the player list! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@378869779668140042> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
RonJames
RonJamesOP2w ago
@kapa.ai So then if I spawn in a player prefab using the realtime avatar manager, what is the timing of them being granted authority over the prefab, is it after it has been spawned?
maxweisel
maxweisel7d ago
it’s instant. the ownership settings go out with the instantiate call. there’s no delay the object is created with those ownership and lifetime flags settings

Did you find this page helpful?