docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ArRecordingConfig

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

    Implements
    IEquatable<ArRecordingConfig>
    IDisposable
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARCore
    Assembly: Unity.XR.ARCore.dll
    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()

    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
    bool

    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
    bool

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

    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
    bool

    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
    int

    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
    int

    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, bool)

    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.

    bool 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, int)

    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.

    int value

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

    Operators

    operator ==(ArRecordingConfig?, ArRecordingConfig?)

    Tests for equality.

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

    The nullable ArRecordingConfig to compare with rhs.

    ArRecordingConfig? rhs

    The nullable ArRecordingConfig to compare with lhs.

    Returns
    Type Description
    bool

    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
        }
    }

    operator ==(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
    bool

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

    explicit operator IntPtr(ArRecordingConfig)

    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

    operator !=(ArRecordingConfig?, ArRecordingConfig?)

    Tests for inequality.

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

    The native object to compare with rhs.

    ArRecordingConfig? rhs

    The native object to compare with lhs.

    Returns
    Type Description
    bool

    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
        }
    }

    operator !=(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
    bool

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

    Implements

    IEquatable<T>
    IDisposable
    In This Article
    Back to top
    Copyright © 2024 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)