# Multiplayer

Creating a Shared AR Experience

# About this Sample

This sample shows how Multiplayer AR can be used to create an engaging augmented reality experience with your application. A multiplayer AR experience allows multiple users to share and interact with virtual objects in real-time, making it truly immersive and social.

This capability opens up new possibilities for creating engaging AR applications, where users can collaborate, compete, and explore together in a shared virtual world. Upon completing this sample, you will have a fully functional Multiplayer AR scene that leverages the power of collaborative augmented reality. To start working with this sample, you need to install Resight Engine.

# Follow these steps after setting up Resight Engine:

  1. Go to the Resight Samples/Multiplayer AR Sample folder
  2. Locate the scene named “Multiplayer AR” and open it

# Multiplayer AR Scene

The AR setup is complete and features an AR Session to oversee the AR experience, as well as an AR Session Origin, which contains the Main Camera, The AR Plane Manager, and the AR Raycast Manager. The scene is also equipped with Resight Engine.

# Resight Engine Settings

  1. Go to the 'Resight' game object in the open scene
  2. Find the 'LibResight' component
  3. Enter your developer key (provided by Resight) and a namespace

    • A namespace can be any string (without spaces), for example, Default / Production / Test-1
    • A namespace is a unique data store under your developer account
    • Mapping data and snapped objects are not shared between different namespaces


For multiplayer experiences to work, it's essential to maintain the same namespace across various devices. Persistent and shared objects should be placed in the "Resources" folder.

# Mesh Manager

  1. Go to the 'Resight' game object in the open scene
  2. Find the 'Mesh Manager' component

# Physics:

You have the option to disable the collider. This can be useful when you don't want objects to collide with the mesh.

# Rendering:

  1. Select a pre-made shader/material for your mesh. This can save you time and effort as you can choose from a range of pre-existing options rather than creating your own from scratch.
  2. Add your own custom shader/material.

# AR Occlusion Manager

The AR Occlusion Manager provides real-time occlusion of virtual objects in AR scenes. Occlusion refers to the effect of blocking the view of one object by another, as occurs when one object is placed in front of another in the real world.

# Entities Manager

The Entities Manager component stores the position and orientation of virtual objects, ensuring that they remain anchored in the correct location.

# Snapped Object

  1. Go to the 'Prefabs' folder in your project
  2. Double-click on one of the Prefabs, 'Ground' or 'Tree'
  3. Look for the 'SnappedObject' script attached to the object

The 'SnappedObject' script provides persistence for objects by allowing them to be placed in the world and "stick" to the physical environment. Once you attach this script to your Prefabs, the objects will remain in place and stable, even when switching between sessions or closing and reopening the application. If you want to rename an object, make sure to add the script again to ensure that the object remains persistent.

# Game Manager

The MeshPlacement script utilizes Physics's Raycast functions to facilitate the real-world placement of objects. If desired, you have the option to personalize the scene by substituting the default objects with your own Prefabs.

  1. Find the Game Manager object in the Hierarchy
  2. Drag and drop your own Prefab to Placed Prefab:

    This scene utilizes the movement scripts to facilitate effortless manipulation and removal of objects in collaboration with our live mesh.

    The scene comes with pre-made materials, 3D models, and Prefabs that are ready for your use without any restrictions. Enjoy! 🙃