using UnityEngine;
using UnityEngine.Events;
using System.Collections;

public class ExampleClass : MonoBehaviour
    UnityEvent m_MyEvent;

    void Start()
        if (m_MyEvent == null)
            m_MyEvent = new UnityEvent();


    void Update()
        if (Input.anyKeyDown && m_MyEvent != null)

    void Ping()

XR plug-ins



The Unity XR plug-in framework provides the basis for XR development in Unity. You can add support for an XR device to a project by installing and enabling the relevant XR plug-in. You can add or remove plug-ins to the project at any time.



See Project set up for instructions on how to add XR plug-ins to your project using the XR Plug-in Management system.



Unity supports the following XR plug-ins:

See XR Platform System Requirements for system requirements for developing XR projects in Unity.




  • One plug-in can support more than one type of XR device and more than one operating system.
  • Plug-ins for additional XR devices might be available from their platform creators or other third parties.
  • Unity does not directly support XR on WebGL. Projects that support WebXR, such as Needle EngineSimpleWebXR, and WebXR Export, are available.