Real-Time Object view
I need everyone to see a game object over each of the players head in the same instance. Do I use real-time view or transform? Or is there another script I need to attach to the object?
12 Replies
Hi @Rex G. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To have a game object (such as a label, icon, or indicator) appear above each player's head and be visible to all players in real-time, you should use a combination of RealtimeView and RealtimeComponent (such as RealtimeTransform) on that object.
Here’s how you can approach this:
1. RealtimeView:
Attach a RealtimeView to the object you want to synchronize. This is essential for identifying and synchronizing the object and its components across all clients. The RealtimeView ensures that the object and its state are tracked in the Normcore datastore and kept in sync for everyone in the room.
RealtimeView documentation 2. RealtimeTransform:
Attach a RealtimeTransform to the object if you want its position (e.g., above the player’s head) to be synchronized across all clients. This is especially important if the object needs to move with the player or be repositioned in real-time. The RealtimeTransform will ensure that the object's transform (position, rotation, scale) is updated for all players, but only the owner can move it unless ownership is transferred.
RealtimeTransform documentation 3. Parenting:
While you might be tempted to parent the object to the player’s head, be aware that Normcore does not synchronize parent-child relationships between objects. Instead, you should update the position of the object (e.g., via script) to follow the player’s head transform, and then synchronize that position using RealtimeTransform.
RealtimeView common questions Summary:
- Use RealtimeView to synchronize the object. - Use RealtimeTransform to synchronize its position above the player’s head. - Update the object’s position in your script to follow the player’s head, and let RealtimeTransform handle the network sync. If you want to synchronize additional data (like a player name or status), you can create a custom RealtimeComponent and model for that data. If you need a concrete example or code, let me know! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Attach a RealtimeView to the object you want to synchronize. This is essential for identifying and synchronizing the object and its components across all clients. The RealtimeView ensures that the object and its state are tracked in the Normcore datastore and kept in sync for everyone in the room.
RealtimeView documentation 2. RealtimeTransform:
Attach a RealtimeTransform to the object if you want its position (e.g., above the player’s head) to be synchronized across all clients. This is especially important if the object needs to move with the player or be repositioned in real-time. The RealtimeTransform will ensure that the object's transform (position, rotation, scale) is updated for all players, but only the owner can move it unless ownership is transferred.
RealtimeTransform documentation 3. Parenting:
While you might be tempted to parent the object to the player’s head, be aware that Normcore does not synchronize parent-child relationships between objects. Instead, you should update the position of the object (e.g., via script) to follow the player’s head transform, and then synchronize that position using RealtimeTransform.
RealtimeView common questions Summary:
- Use RealtimeView to synchronize the object. - Use RealtimeTransform to synchronize its position above the player’s head. - Update the object’s position in your script to follow the player’s head, and let RealtimeTransform handle the network sync. If you want to synchronize additional data (like a player name or status), you can create a custom RealtimeComponent and model for that data. If you need a concrete example or code, let me know! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@918869683929768036> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Attach a child of the head game object. you shouldn't need an extra view or transform for this
Or make it a sibling of the head and sync the position locally to be above it
This is how you set it up? I need for everyone to see when this gameobject is active and not active. This will be on all of the player in the instances head. I need them to see when it becomes active and inactive

sync a bool on the avatar to make the headphones appear
@kapa.ai write some code to sync the active state of a pair of headphones on my avatar
Let me check the knowledge base for you again. One moment! :books:
----------------------
To synchronize the active state (e.g., on/off or visible/invisible) of a pair of headphones on your avatar across all clients, you should create a custom RealtimeComponent and a corresponding RealtimeModel with a boolean property representing the active state. This approach is directly supported by Normcore’s custom data synchronization system.
Below is an example based on the official documentation for synchronizing custom data. This code will let you toggle the headphones’ active state and have that change reflected for all users in the room.
1. Create the RealtimeModel for the headphones’ active state:
If you need more details on setting up custom models and components, see the Synchronizing Custom Data guide. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
TheCreating a realtime model 2. Create the RealtimeComponent to control the headphones:[RealtimeModel]
and[RealtimeProperty]
attributes are required for Normcore to generate the networking code for your model. The boolean_isActive
will be synchronized across all clients.
This script synchronizes the active state of the headphones GameObject. When you callCreating a RealtimeComponent subclass How to use: - Attach theSetHeadphonesActive(true/false)
, the change is propagated to all clients, and the headphones’ visibility is updated accordingly.
HeadphonesSync
script to your avatar.
- Assign the headphones GameObject in the inspector.
- Call SetHeadphonesActive(true)
or SetHeadphonesActive(false)
to toggle the headphones for all users.
This approach ensures the active state of the headphones is kept in sync for all players in the room.If you need more details on setting up custom models and components, see the Synchronizing Custom Data guide. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@162940911964258305> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I need to be able to click something in the actual scene to set the active state inactive and active using this. Can I add this to the scene?
when you click that thing call this function SetHeadphonesActive(true)
I'd suggest you run this tutorial https://normcore.io/documentation/realtime/synchronizing-custom-data.html#realtime-components
Synchronizing Custom Data | Normcore Documenation
In this guide, I’m going to walk you through how to synchronize custom data in your Unity application using custom realtime components.
I am using this to call the method is this correct?


And will this work the same when I make the object inactive?