Sync Headphone being viewable
I am struggling to make it so everyone sees a gameobject over the players head go active and inactive. Here is my script using the example your document have provided. I just need everyone to see when it is active and inactive. Everyone has this gameobject on their rig and they will be making it active and inactive throughout the room.
35 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 synchronize the active/inactive state of a GameObject (like a headphone icon above a player's head) so that all users in the room see the same state, you need to synchronize this state using a custom RealtimeComponent and model in Normcore. The built-in components (like RealtimeTransform) only sync position, rotation, and scale—not active state.
Here’s how you can approach this, based on the official guide for synchronizing custom data:
1. Create a custom model to store the active state (e.g., a boolean).
2. Create a custom RealtimeComponent that updates the GameObject’s active state based on the model and updates the model when the local user changes the state.
Example
1. Create the model:
After creating this, use the Normcore inspector to compile the model code as described in the docs. This will generate the code needed to sync the property across the network [Synchronizing Custom Data].
2. Create the RealtimeComponent:
- Attach this script to the same GameObject as your headphone icon.
- Assign the headphone GameObject in the inspector.
- Call
SetHeadphoneActive(true/false)
when you want to change the state.
This will ensure that when any user changes the headphone state, it is synchronized for all users in the room [Synchronizing Custom Data].
Note: Make sure your prefab has a RealtimeView on the root and is instantiated using Realtime.Instantiate()
if you want it to be networked [Realtime API].
If you need more details on compiling the model or wiring up the prefab, see the official guide: Synchronizing Custom Data.
If you have further issues, please provide your current script and setup for more targeted help!
----------------------
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.
this looks correct ^
how are you activating the headphones on the owner client, is it by calling
SetActiveState
?Yes by clicking a button
Do I have to set ownership?
if the headphones are on the player avatar then only the owners can change the model, you can't take ownership of other people's avatar
I don't need to take ownership. I just need for everyone to see everyone's headphones on their head in real time being set active and inactive
you can try setting the headphones as a child of this game object so you're not disabling the script at the same time
and only setting the headphones active state
Basically I need to give the effect a pair of headphones appear on their head when they click a music choice on a playlist in the app and every needs to see the headphones on their head and when they close the playlist the headphones go back to inactive
The headphones is attached to the center eye anchor of the OVR Camera Rig here

is that rig the avatar that gets spawned by Realtime? cos if it's in the scene then that view will be shared by all players
what you want to do is either have the headphones on the avatar that gets spawned
or just Realtime.Instantiate the headphones at runtime separately
Attach it to this? The Meta Avatar Prefab? But how do I set it into inactive and active state?

yeah it should be on that
the ovr rig shouldn't have any network stuff on it
Ok so how in my scene can I access the script attached to toggle it to active and inactive state?
you can find your local avatar in Avatar Manager or add a isOwnedLocallyInHeirarchy check to the start function of the headphones
I need to be able to call the method on this Interactable Unity Event Wrapper because this is the scriipt attached to object they are clicking to change the state.

Here is where it is checked in the start function
You can edit your headphones script to include a static variable called localInstance which is assigned in Start if isOwnedLocallyInHierarchy is true
Then add a script to your event object that fires the set active function on your static variable
So attach this to the gameobject with the Interactable unity event wrapper correct?

You probably cant see it but I got it to appear on start when their avatar loads now I need to be able to set it inactive when they click an object using Interactable unity event wrapper from that headphone prefab
I added the static variable but when I try to click the gameobject with Interactable event wrapper the headphones don't become active or inactive. I need it to start as inactive and when they click that gameobject it becomes active and vice versa
??? @Mechabit
looks fine to me, you should add some debug logs to see when the method gets called
Finally figured this out but one question. I need the headphone to be stuck to the individual transform of the joint head for each player that is generated on the Normal Meta Avatar. How can I do that?
use a script to move the headphone every frame
I am running into issues with these three scripts. When a player presses a button to show their headphones GameObject, it should become visible for everyone else too—but it shouldn't affect visibility on other players' avatars. Right now, it's only toggling locally and not syncing across the network. I need help syncing per-player headphone visibility so others can see it.
doesn't look like you're calling ToggleHeadphones ?
add a debug log to see when something is called
Got it to work
One issue someone else in the server sees the gameobject is in the position on their head like I need it to but from the players view it looks like the object is floating above their head. I have a realtime view and realtime transform on the gameobject I need
Any help with this? It shows up in the right spot on the inspector. I made sure to parent it with the Joint Head so it is at the transform of the Joint Head that spawns at runtime on the Normal Meta Avatar but on the headset it appears either on the floor or next to the player. It needs to fit onto the head like a pair of headphones

Realtime Transform doesn't support parenting
you have to move the headphones to the correct position every frame
or if you only ever need the headphones on the person's head and don't need Realtime Transform make sure it is reparented on all remote clients cos that doesn't happen automatically
Ok the headphones just need to keep its position on that players head so everyone can see it. Thats why I kept the realtime transform because when testing everyone could see when someone switched their headphones to an active state. I just want to make sure if I remove realtime transform that doesn't change
you don't need RT for that
Ok