Name sync
Anyone has any ideas for why when I enter the room, I can see everyone else's names but they don't see mine? The next person who will enter will see everyone else's (including mine), but we wont see theirs. I'm syncing a string in a model here.
Solution:Jump to solution
Typically you want to make sure you're doing it in both places. OnRealtimeModelReplaced catches existing state in the room, while change events will fire for changes that occurred after you joined.
6 Replies
Hi @Ryllexya. 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 you're synchronizing the player's name in your application. If you're using Normcore's RealtimeModel to synchronize the player's name, make sure that you're correctly setting up the model and its properties. Here's an example of how a typical RealtimeModel looks like:
In this example,
_name
is a private string that's being synchronized across all clients. The true
argument in the RealtimeProperty
attribute indicates that this property should be synchronized (source (https://normcore.io/documentation/room/realtimemodel)).
If you're using the Connect()
method to connect to a room, make sure that all clients are connecting to the same room with the same app key. All clients that connect to the same room name with the same app key will connect to the same room server (source (https://normcore.io/documentation/room/room#connecting-to-a-room-server)).
If you're using the Realtime API, it will automatically connect to a room when your application starts if "Join Room On Start" is enabled. It's also possible to join a room by calling the Connect()
method along with the name of the room you would like to join. All clients that connect to the same room name will end up connected to the same room server (source (https://normcore.io/documentation/realtime)).
If you're still having issues, it might be helpful to check out the Synchronizing custom data (https://normcore.io/documentation/realtime/synchronizing-custom-data) guide for more information on how to use a RealtimeModel in practice.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@164038313924231178> kapa.ai is still learning and improving, please let us know how it did by reacting below
womp womp. I don't think this is the issue
In short, typically I see this behavior when people update UI only via OnRealtimeModelReplaced /or/ the property did change event.
Solution
Typically you want to make sure you're doing it in both places. OnRealtimeModelReplaced catches existing state in the room, while change events will fire for changes that occurred after you joined.
I was hoping Kapa would catch that one, but no dice. I may write up a docs page for this. I see enough folks hit it.
I see, thank you for helping, I'll give this a go.