docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface OpenXRLayerProvider.ILayerHandler

    An interface used by the OpenXRLayerProvider to communicate layer data changes to registered layer handlers.

    Namespace: UnityEngine.XR.OpenXR.CompositionLayers
    Assembly: Unity.XR.OpenXR.dll
    Syntax
    public interface OpenXRLayerProvider.ILayerHandler
    Remarks

    ILayerHandler instances must register themselves via RegisterLayerHandler(Type, ILayerHandler) to specify the LayerData type to handle. If more than one object registers itself as a handler for a specific LayerData type, the last registered handler is used.

    The OpenXRCustomLayerHandler<T> class provides a partial, base implementation of this interface that you can use to create custom layer handlers.

    Methods

    CreateLayer(LayerInfo)

    Called by the OpenXRLayerProvider when a new LayerData object of the type registered to this ILayerHandler instance has been created.

    Declaration
    void CreateLayer(CompositionLayerManager.LayerInfo layerInfo)
    Parameters
    Type Name Description
    LayerInfo layerInfo

    Container for the instance id and CompositionLayer component of the composition layer that was just created.

    ModifyLayer(LayerInfo)

    Called by the OpenXRLayerProvider when a LayerData object or any attached extension components have had a member modified.

    Declaration
    void ModifyLayer(CompositionLayerManager.LayerInfo layerInfo)
    Parameters
    Type Name Description
    LayerInfo layerInfo

    Container for the instance id and CompositionLayer component of the composition layer that was modified.

    OnUpdate()

    Called by the OpenXRLayerProvider during the Unity Update loop. All implementations must call AddActiveLayersToEndFrame(void*, void*, int, int) every frame to add their native layer structs to the endFrameInfo struct inside the UnityOpenXR lib.

    Declaration
    void OnUpdate()

    RemoveLayer(int)

    Called by the OpenXRLayerProvider when a LayerData object of the type registered to this ILayerHandler instance has been destroyed or disabled.

    Declaration
    void RemoveLayer(int id)
    Parameters
    Type Name Description
    int id

    SetActiveLayer(LayerInfo)

    Called every frame by the OpenXRLayerProvider for all currently active LayerData objects of the type registered to this ILayerHandler instance.

    Declaration
    void SetActiveLayer(CompositionLayerManager.LayerInfo layerInfo)
    Parameters
    Type Name Description
    LayerInfo layerInfo

    Container for the instance id and CompositionLayer component of the composition layer being set to active.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)