docs.unity3d.com
    Show / Hide Table of Contents

    Struct ArRecordingConfig

    A recording configuration struct that contains the configuration for session recording. See StartRecording(ArRecordingConfig).

    Inherited Members
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: UnityEngine.XR.ARCore
    Syntax
    public struct ArRecordingConfig : IEquatable<ArRecordingConfig>, IDisposable
    Remarks

    A ArRecordingConfig represents a native object that must be disposed (by calling Dispose()) to prevent memory leaks. Consider using a using statement for convenience:

       void RecordExample(ARCoreSessionSubsystem subsystem, string mp4Path)
       {
           var session = subsystem.session;
           using (var config = new ArRecordingConfig(session))
           {
               config.SetMp4DatasetFilePath(session, mp4Path);
               config.SetRecordingRotation(session, 90);
               config.SetAutoStopOnPause(session, false);
               var status = subsystem.StartRecording(config);
               Debug.Log($"StartRecording to {config.GetMp4DatasetFilePath(session)} => {status}");
           }
       }

    This is a C# wrapper for ARCore's native ArRecordingConfig

    Constructors

    ArRecordingConfig(ArSession)

    Creates a dataset recording config object. This object must be disposed with Dispose().

    Declaration
    public ArRecordingConfig(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Methods

    AsIntPtr()

    Gets the underlying native pointer for this ArRecordingConfig.

    Declaration
    public IntPtr AsIntPtr()
    Returns
    Type Description
    IntPtr

    Returns the underlying native pointer for this ArRecordingConfig.

    Dispose()

    Releases memory used by this recording config object.

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    Equals(Object)

    Tests for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    An Object to compare against.

    Returns
    Type Description
    Boolean

    Returns true if obj is an ArRecordingConfig and it compares equal to this one using Equals(ArRecordingConfig).

    Overrides
    ValueType.Equals(Object)

    Equals(ArRecordingConfig)

    Tests for equality.

    Declaration
    public bool Equals(ArRecordingConfig other)
    Parameters
    Type Name Description
    ArRecordingConfig other

    The ArRecordingConfig to compare against.

    Returns
    Type Description
    Boolean

    Returns true if the underlying native pointers are the same. Returns false otherwise.

    Implements
    IEquatable<T>.Equals(T)
    Remarks

    Two ArRecordingConfigs are considered equal if their underlying pointers are equal.

    FromIntPtr(IntPtr)

    Create a ArRecordingConfig from an existing native pointer. The native pointer must point to an existing ArRecordingConfig.

    Declaration
    public static ArRecordingConfig FromIntPtr(IntPtr value)
    Parameters
    Type Name Description
    IntPtr value

    A pointer to an existing native ArRecordingConfig.

    Returns
    Type Description
    ArRecordingConfig

    Returns an ArRecordingConfig whose underlying native pointer is value.

    GetAutoStopOnPause(ArSession)

    Gets the setting that indicates whether this recording should stop automatically when the ARCore session is paused.

    Declaration
    public bool GetAutoStopOnPause(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    Boolean

    Returns true if this recording should stop when the ARCore session is paused. Returns false otherwise.

    GetHashCode()

    Generates a hash code suitable for use with a HashSet or Dictionary

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    Returns a hash code for this ArRecordingConfig.

    Overrides
    ValueType.GetHashCode()

    GetMp4DatasetFilePath(ArSession)

    Gets the file path to save an MP4 dataset file for this recording.

    Declaration
    public string GetMp4DatasetFilePath(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    String

    Returns the path to the MP4 dataset file to which the recording should be saved.

    GetRecordingRotation(ArSession)

    Gets the clockwise rotation in degrees that should be applied to the recorded image.

    Declaration
    public int GetRecordingRotation(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    Int32

    Returns the rotation in degrees that will be applied to the recorded image. Possible values are 0, 90, 180, 270, or -1 if unspecified.

    SetAutoStopOnPause(ArSession, Boolean)

    Sets whether this recording should stop automatically when the ARCore session is paused.

    Declaration
    public void SetAutoStopOnPause(ArSession session, bool value)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Boolean value

    If true, this recording will stop automatically when the ARCore session is paused. If false, the recording will continue.

    SetMp4DatasetFilePath(ArSession, String)

    Sets the file path to save an MP4 dataset file for the recording.

    Declaration
    public void SetMp4DatasetFilePath(ArSession session, string path)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    String path

    The file path to which an MP4 dataset should be written.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if path is null.

    SetRecordingRotation(ArSession, Int32)

    Specifies the clockwise rotation in degrees that should be applied to the recorded image.

    Declaration
    public void SetRecordingRotation(ArSession session, int value)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Int32 value

    The clockwise rotation in degrees (0, 90, 180, or 270).

    Operators

    Equality(Nullable<ArRecordingConfig>, Nullable<ArRecordingConfig>)

    Tests for equality.

    Declaration
    public static bool operator ==(ArRecordingConfig? lhs, ArRecordingConfig? rhs)
    Parameters
    Type Name Description
    Nullable<ArRecordingConfig> lhs

    The nullable ArRecordingConfig to compare with rhs.

    Nullable<ArRecordingConfig> rhs

    The nullable ArRecordingConfig to compare with lhs.

    Returns
    Type Description
    Boolean

    Returns true if any of these conditions are met:

    • lhs and rhs are both not null and their underlying pointers are equal.
    • lhs is null and rhs's underlying pointer is null.
    • rhs is null and lhs's underlying pointer is null.
    • Both lhs and rhs are null.

    Returns false otherwise.

    Remarks

    This equality operator lets you to compare an ArRecordingConfig with null to determine whether its underlying pointer is null. This allows for a more natural comparison with the native ARCore object:

    bool TestForNull(ArRecordingConfig obj)
    {
        if (obj == null)
        {
            // obj.AsIntPtr() is IntPtr.Zero
        }
    }

    Equality(ArRecordingConfig, ArRecordingConfig)

    Tests for equality. Same as Equals(ArRecordingConfig).

    Declaration
    public static bool operator ==(ArRecordingConfig lhs, ArRecordingConfig rhs)
    Parameters
    Type Name Description
    ArRecordingConfig lhs

    The ArRecordingConfig to compare with rhs.

    ArRecordingConfig rhs

    The ArRecordingConfig to compare with lhs.

    Returns
    Type Description
    Boolean

    Returns true if lhs is equal to rhs using Equals(ArRecordingConfig). Returns false otherwise.

    Explicit(ArRecordingConfig to IntPtr)

    Casts an ArRecordingConfig to its underlying native pointer.

    Declaration
    public static explicit operator IntPtr(ArRecordingConfig config)
    Parameters
    Type Name Description
    ArRecordingConfig config

    The ArRecordingConfig to cast.

    Returns
    Type Description
    IntPtr

    Returns the underlying native pointer for config

    Inequality(Nullable<ArRecordingConfig>, Nullable<ArRecordingConfig>)

    Tests for inequality.

    Declaration
    public static bool operator !=(ArRecordingConfig? lhs, ArRecordingConfig? rhs)
    Parameters
    Type Name Description
    Nullable<ArRecordingConfig> lhs

    The native object to compare with rhs.

    Nullable<ArRecordingConfig> rhs

    The native object to compare with lhs.

    Returns
    Type Description
    Boolean

    Returns false if any of these conditions are met:

    • lhs and rhs are both not null and their underlying pointers are equal.
    • lhs is null and rhs's underlying pointer is null.
    • rhs is null and lhs's underlying pointer is null.
    • Both lhs and rhs are null.

    Returns true otherwise.

    Remarks

    This inequality operator lets you to compare an ArRecordingConfig with null to determine whether its underlying pointer is null. This allows for a more natural comparison with the native ARCore object:

    bool TestForNull(ArRecordingConfig obj)
    {
        if (obj != null)
        {
            // obj.AsIntPtr() is not IntPtr.Zero
        }
    }

    Inequality(ArRecordingConfig, ArRecordingConfig)

    Tests for inequality. Same as the negation of Equals(ArRecordingConfig).

    Declaration
    public static bool operator !=(ArRecordingConfig lhs, ArRecordingConfig rhs)
    Parameters
    Type Name Description
    ArRecordingConfig lhs

    The ArRecordingConfig to compare with rhs.

    ArRecordingConfig rhs

    The ArRecordingConfig to compare with lhs.

    Returns
    Type Description
    Boolean

    Returns false if lhs is equal to rhs using Equals(ArRecordingConfig). Returns true otherwise.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023