Struct ArRecordingConfig
A recording configuration struct that contains the configuration for session recording. See StartRecording(ArRecordingConfig).
Inherited Members
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.
This is a C# wrapper for ARCore's native ArRecordingConfig
Examples
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}");
}
}
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 native pointer for this instance.
Declaration
public IntPtr AsIntPtr()
Returns
Type | Description |
---|---|
IntPtr | The native pointer. |
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 |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
Equals(ArRecordingConfig)
Tests for equality.
Declaration
public bool Equals(ArRecordingConfig other)
Parameters
Type | Name | Description |
---|---|---|
ArRecordingConfig | other | The instance to compare against. |
Returns
Type | Description |
---|---|
bool | true if the native pointers are equal. Otherwise, returns false. |
Remarks
Two instances are considered equal if their native pointers are equal.
FromIntPtr(IntPtr)
Create an instance from a 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 | An instance whose native pointer is |
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 |
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 instance. |
Overrides
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 |
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 |
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? | rhs | The nullable |
Returns
Type | Description |
---|---|
bool | true if any of these conditions are met:
-
|
Remarks
This equality operator lets you compare an instance with null to determine whether its native pointer is null.
Examples
bool TestForNull(ArRecordingConfig obj)
{
if (obj == null)
{
// obj.AsIntPtr() is IntPtr.Zero
}
}
operator ==(ArRecordingConfig, ArRecordingConfig)
Tests for equality. Equivalent to Equals(ArRecordingConfig).
Declaration
public static bool operator ==(ArRecordingConfig lhs, ArRecordingConfig rhs)
Parameters
Type | Name | Description |
---|---|---|
ArRecordingConfig | lhs | The instance to compare with |
ArRecordingConfig | rhs | The instance to compare with |
Returns
Type | Description |
---|---|
bool | true if |
explicit operator IntPtr(ArRecordingConfig)
Casts an instance to its native pointer.
Declaration
public static explicit operator IntPtr(ArRecordingConfig config)
Parameters
Type | Name | Description |
---|---|---|
ArRecordingConfig | config | The instance to cast. |
Returns
Type | Description |
---|---|
IntPtr | The native pointer. |
operator !=(ArRecordingConfig?, ArRecordingConfig?)
Tests for inequality.
Declaration
public static bool operator !=(ArRecordingConfig? lhs, ArRecordingConfig? rhs)
Parameters
Type | Name | Description |
---|---|---|
ArRecordingConfig? | lhs | The nullable |
ArRecordingConfig? | rhs | The nullable |
Returns
Type | Description |
---|---|
bool | false if any of these conditions are met:
-
|
Remarks
This inequality operator lets you compare an instance with null to determine whether its
native pointer is null
.
Examples
bool TestForNull(ArRecordingConfig obj)
{
if (obj != null)
{
// obj.AsIntPtr() is not IntPtr.Zero
}
}
operator !=(ArRecordingConfig, ArRecordingConfig)
Tests for inequality. Equivalent to the negation of Equals(ArRecordingConfig).
Declaration
public static bool operator !=(ArRecordingConfig lhs, ArRecordingConfig rhs)
Parameters
Type | Name | Description |
---|---|---|
ArRecordingConfig | lhs | The instance to compare with |
ArRecordingConfig | rhs | The instance to compare with |
Returns
Type | Description |
---|---|
bool | false if |