Forum Discussion

BoBJustPotato's avatar
1 month ago

Problem with SharedSpace and Colocation

I'm currently working on a mixed reality project, the idea is to allow two players who are physically in the same real world space to place objects around the room. Right now I'm working on the multiplayer part of the project. I used a custom script instead of the Building Blocks to connect both users using Photon Fusion and create a room with a code.

The problem is that, during testing, the players do not see objects in the same positions. The objects move correctly, but they appear in different locations for each user.

To fix this, I started looking into Space Sharing and Colocation so I can ensure both users share the same room alignment and anchors. I started implementing it, but I ran into another problem: I don't seem to be able to test it properly, is the only way to test this with two physical devices? Currently, I'm trying to test using one device and the Unity Editor with XR Simulator. When testing, I can see all the debug logs on the device build. When using the XR Simulator, it does not finish the process of creating the anchor IDs, and if it is running as the client, it never finishes retrieving the anchors either, in both cases, it only shows: "Starts the process..." (<- my debug log)

For the Building Blocks, I'm using Passthrough, Shared Spatial Anchor Core, NetworkManager, Platform Init, and Effect Mesh to verify whether both users are sharing the same room.

3 Replies

  • Degly's avatar
    Degly
    Start Mentor

    Yes for proper Shared Spatial Anchor / colocation testing, you realistically need two physical Quest devices to make sure that everything works in your physical space.

    The Unity XR Simulator does not fully emulate everything, but works for development good enough though.

    Also, your original issue (objects appearing in different locations) is exactly what SSA/colocation is meant to solve. Right now both users probably have different local tracking origins. Remember to always recenter the headsets when you launch the application.

    A few important notes:

    • Both headsets must map the SAME physical space
    • Use the same shared anchor UUIDs across clients
    • Wait until anchors are fully localized before spawning networked content

    Common mistake:

    • Networking object transforms before world alignment is complete

    Recommended flow:

    1. Create/share/load anchor
    2. Localize anchor on both devices
    3. Align world origin
    4. THEN spawn synchronized objects

    Without that order, Photon transforms will still mismatch spatially.

    • BoBJustPotato's avatar
      BoBJustPotato
      Explorer

      I put my order comment as a reply to myself ksks, but just so I know: using the Simulator + Device should work, right? To see both the Shared Space and colocation?

  • I was using Unity XR Simulator + Device with build to test the Shared Spatial Anchor and Colocation, i was hoping that the room i had scanned in my device would appear in the XR simulator when i enter the room but it dont seem to be working, i was presuming that it was because i was testing Simulator x Device because looking at the immersive console everything works fine in the device but not in the simulator.

→ Find helpful resources to begin your development journey in Getting Started

→ Get the latest information about HorizonOS development in News & Announcements.

→ Access Start program mentor videos and share knowledge, tutorials, and videos in Community Resources.

→ Get support or provide help in Questions & Discussions.

→ Show off your work in What I’m Building to get feedback and find playtesters.

→ Looking for documentation?  Developer Docs

→ Looking for account support?  Support Center

→ Looking for the previous forum?  Forum Archive

→ Looking to join the Start program? Apply here.

 

Recent Discussions