First player isn't synced to other players, while other players are visible to the first player
No idea why this started happening - didn't change any code from what I can tell, but now whenever a new player joins they can't see the other players in the room. Only the first player to join can see the others
30 Replies
Hi @Outlawdlaw. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
This issue might be related to how the state of the room and objects are synchronized in NormalVR. According to the documentation (https://normcore.io/documentation/architecture/client#datastore), all state is synchronized using the room's datastore. If you need to move an object in the world, you change its position in the datastore. The datastore will automatically detect any changes and notify all clients connected to the room so they can update their world to match.
If a player joins the match late, one of the existing clients would now be responsible for catching up the new client with the state of the room. However, with Normcore’s datastore, there’s no need to manually synchronize clients like this. If you make a change to the datastore, it’s automatically replicated to all connected clients. And when a client joins a room late, the server is able to send them a complete copy of the datastore without requiring any intervention from the other clients.
If the issue persists, it might be related to how RPC messages are handled in Normcore. As per the documentation (https://normcore.io/documentation/room/room#rpcs), RPC messages in Normcore are available as a last resort. If you have players that can join a room late, RPC messages make consistent synchronization difficult. Any state modified in response to an RPC message will need to be manually synchronized by your own code.
If you're trying to debug ownership settings at runtime, the
RealtimeView
inspector includes Request Ownership and Clear Ownership buttons that function like calling RequestOwnership()
or ClearOwnership()
in code as mentioned in the documentation (https://normcore.io/documentation/room/ownership-and-lifetime-flags#at-runtime-with-the-unity-inspector).
Please check these aspects in your code and see if they help resolve the issue.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@290458313882337280> kapa.ai is still learning and improving, please let us know how it did by reacting below
@Normcore Assistant I'm following the basic getting started tutorial, I haven't used RPCs or done anything to the datastore
Let me check the knowledge base for you. One moment! :books:
----------------------
If you're following the basic getting started tutorial and haven't made any changes to the datastore or used RPCs, then it's possible that the issue might be related to how objects are being synchronized in your scene.
In Normcore, the state of objects is synchronized using the room's datastore. When a player joins a room late, the server sends them a complete copy of the datastore, which includes the state of all objects in the room. This is done automatically without requiring any intervention from the other clients (source (https://normcore.io/documentation/architecture/client#datastore)).
However, there are some common issues that can prevent objects from being properly synchronized:
1. Object Serialization: Only primitive types (
int
, float
, Vector3
, string
, etc.) can be serialized. If you're trying to sync a specific kind of object like a TextMesh Pro object, you should create a field for each property on the object that you’d like to sync (source (https://normcore.io/documentation/room/common-questions#when-i-try-to-sync-a-specific-object-to-the-datastore-i-get-an-error-that-says-it-cannot-be-serialized-whats-the-issue)).
2. Object Ownership: This error generally happens when multiple clients attempt to delete the same model from a RealtimeSet at the same time. If you’re not using RealtimeSet directly in your project, this can happen if multiple clients call Realtime.Destroy()
on the same object at the same time. In order to prevent this, we generally recommend having the client that owns the object destroy it: if (realtimeView.isOwnedLocally) Realtime.Destroy(gameObject);
(source (https://normcore.io/documentation/room/common-questions#im-getting-the-error-server-attempted-to-delete-value-from-set-for-key-that-doesnt-exist-in-storage-this-is-a-bug-how-do-i-fix-this)).
If you're still having trouble, it might be helpful to revisit the Getting Started (https://normcore.io/documentation/essentials/getting-started) guide to ensure that all steps were followed correctly. If the issue persists, consider reaching out to the Normcore community on their Discord (https://normcore.io/discord) or forum (https://forum.normcore.io/) for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@290458313882337280> kapa.ai is still learning and improving, please let us know how it did by reacting below
have you got your XR rig in the avatar?
I'm not using an XR rig, just a basic hoverbird avatar
have you looked in the editor to see where all the players are?
usually when this happens it's because all the players are stacked up on the camera
On the first player to join / create the room, both players are visible and spawned. On subsequent joiners there's only one player spawned
but did you look in the editor from their prespective?
you can click on the avatar clones to see their position
Yes, that's how I know there's only one clone
so no avatars spawn at all?
Just the one. They spawn fine for the first player
that's never happened before
usually you get avatar clones on all clients or not at all
otherwise no one would be able to see any positions
post a sceenshot of 2 editors from both perspectives
Alright
you can use parrelsync to run 2 editors
The one on the left is the first player
are you just auto connecting to the same room?
I manually provide a room name, if it makes a difference
I very briefly get a log telling me there are 2 audio listeners in the scene for the second player, which leads me to believe that the first avatar is possibly spawned for the second player but then removed🤷♂️
lets see your avatar code
you using singletons at all?
In a sense. I have a Network Manager that's a singleton where I create and join a room. Then I load a new scene and spawn the avatar when the scene loads. The player and the rest aren't singletons
The player code or the code spawning the player?
lets see the avatar code
you can probably cache is owned locally as it's not going to change
Yea, I'm going to redo it as I just copied this from the docs to get it working asap
that seems fine
like you say, the 2nd avatar spawns and is getting destoryed by something
I'd check every script for a destroy
Hmm... there's nothing I've added to destroy players. Haven't even begun with disconnection logic and the rest
I'd add a codebreak at the avatar spawned point and step through the code until the 2nd player gets destroyed
Nope, nothing in my code, unless it's something to do with other packages, but that seems unlikely. Added an OnDestroyed method to the player and it doesn't fire either
Oh well, thanks for the assistance
try using a cube for the avatar with nothing on it