Building a Multiplayer for Magic Leap 2

I am currently considering developing a multiplayer feature in Unity using several Magic Leap 2 devices.

Magic Leap 2 I would like to synchronize the wearer's position, hand tracking position, and animations of several models with the multi-player feature.

Photon Fusion is expensive and requires a monthly subscription. I would like to adopt a system that realizes a multiplayer function that only charges for the amount used.

I would like to know the best way to achieve multiplayer functionality at a lower cost than Photon. By the way, Photon costs $800 per month for the cheapest plan.

By the way, I would like to handle it without using AR Cloud, and I am thinking of using marker tracking or importing mapping data.


Hi @tokufxug,

One low cost option to creating shared experiences on the Magic Leap 2 device is to create a Peer-2-Peer connection between the headsets with WiFi Direct Service Discovery.

With a WiFi Direct connection between the devices I have been able to send messages over a basic sockets layer to share and synchronize the experience between the different users.


Hi @dlamb,
Thank you for your prompt reply.
When you implemented using WiFi Direct, did you develop it in the Unity Editor?
Have you developed using the following Asset? Or did you develop native Android libraries?

I also noticed that Wi-Fi Direct is listed in the Know Issue in the release notes from a year ago.

I apologize for being so selfish,If you could share some sample code or a sample project with us, it would be greatly appreciated.

Best regards.

Hi @tokufxug we are working on a sample that demonstrates how to create a multi-user experiences using Unity's Netcode, which supports a wide range of transports such as Mirror and Pun2.

The approach I took was to create a Unity Android plugin that leverages the Android WiFi Direct Service Discovery APIs Usar o Wi-Fi Direct (P2P) para descoberta de serviços  |  Desenvolvedores Android  |  Android Developers.
I have not tried that Asset from the Unity store.

I believe the WiFi Direct issue mentioned in the Aug 2022 release notes may have been an older settings related issue, but I have found that WiFi Direct is working for me in the latest release build.

What I have working at the moment is not ready for public release, however knowing that others may be interested I will look into the option of possibly sharing a sample of WiFi Direct of some sort.

1 Like