Build cross-platform, multi-user VR experiences across the Web, VR headsets, native mobile apps, and more.
A client library that allows Unity projects to interact with networked-aframe.
Follow the steps below to get a networked-aframe-unity-client (NAF-unity-client) example scene up and running that includes integration with networked-aframe.
First, create a new Unity project. In your Unity project, set the correct Player Settings required for this library:
- Go to Player Settings
- Set "Scripting Backend" to IL2CPP
- Set "API Compatibility Level" to ".NET 4x"
Next, download the NAF-unity-client library:
- Copy the URL
https://github.com/ttravaglini/networked-aframe-unity-client.git
- In Unity, go to Window --> Package Manager --> click (+) --> Add Package from Git URL
- Paste in the URL for this package
Next, download the example scene for this library.
- From the Package Manager window, once the NAF-unity-client package download finishes, expand the "Samples" dropdown for this package and import the "Networked-aframe example scenes" sample
- From the Project window, navigate to the imported "Networked-aframe example scenes" folder
- Open the "BasicEvents" scene
Next, get networked-aframe running locally:
- Go to the networked-aframe repo and follow the steps in their Getting Started section
- At the end of that process, you should have the NAF server running and be able to browse the examples at http://localhost:8080
- Open http://localhost:8080 and then open the example "Basic with events"
At this point, you have the Basic Events example from NAF running in your browser window and the corresponding example scene open in Unity. Now, you can click the Run button in Unity. This will start up the example Unity scene, and you should be able to see and interact with the avatar from the browser window (and vice-versa)! To further explore the functionality, you can open up more than one browser window pointing to the Basic Events NAF example, which will cause multiple avatars to appear in each of the clients.
In this screenshot, we have two browser clients and one Unity client running the Basic Events scene with networked-aframe. The Unity client is represented by the red avatar, and the browser clients are represented by the blue and light green avatars.
BasicEvents_demo_scaled_down.mp4
This video shows the same scenario as above; it shows two browser clients and one Unity client running the Basic Events scene with networked-aframe.
Go to the Components Documentation for more information on how each NAF-unity-client component works and how to integrate it into your own Unity project.
- Currently this library only works in conjunction with the default
wseasyrtc
network adapter within networked-aframe, and it has only been tested locally. - Only a subset of the functionality from NAF has been ported over. Certain functionality, such as object persistence, ownership transfer, custom messages, and more are not yet functional.
- If you're interested in helping out with fixing these issues and others, please consider contributing!
Networked-aframe-unity-client is available under the MIT license.