Class LiveStreamExtensions
Extension methods for LiveStream.
Namespace: Unity.LiveCapture
Syntax
public static class LiveStreamExtensions
Methods
CreateProperty<TComponent, TValue>(LiveStream, String, Action<TComponent, TValue>)
Creates a property from the specified binding information at the root transform.
Declaration
public static LivePropertyHandle CreateProperty<TComponent, TValue>(this LiveStream stream, string propertyName, Action<TComponent, TValue> setter = null)
where TComponent : Component where TValue : struct
Parameters
| Type | Name | Description |
|---|---|---|
| LiveStream | stream | The stream to create the property to. |
| String | propertyName | The name of the property to bind to. |
| Action<TComponent, TValue> | setter | The action that sets the value to the component's property. This is needed for some builtin components where the property can't be set using reflection. |
Returns
| Type | Description |
|---|---|
| LivePropertyHandle | A LivePropertyHandle representing the property. |
Type Parameters
| Name | Description |
|---|---|
| TComponent | The type of the component to bind to. |
| TValue | The type of the data to bind to. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if the stream is null. |
SetLive(LiveStream, LivePropertyHandle, Boolean)
Sets the live state of the property associated with the specified LivePropertyHandle.
Declaration
public static void SetLive(this LiveStream stream, LivePropertyHandle handle, bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| LiveStream | stream | The stream containing the property. |
| LivePropertyHandle | handle | The LivePropertyHandle representing the property. |
| Boolean | value | The live state to set to the property. |
Remarks
A property with its live state set to true will animate its target component and participate in an ongoing recording. A live state set to false, won't.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if the stream is null. |
SetMaxError(LiveStream, LivePropertyHandle, Single)
Sets the tolerance to use when reducing keyframes during a recording of the property associated with the specified LivePropertyHandle.
Declaration
public static void SetMaxError(this LiveStream stream, LivePropertyHandle handle, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| LiveStream | stream | The stream containing the property. |
| LivePropertyHandle | handle | The LivePropertyHandle representing the property. |
| Single | value | The tolerance to set expressed as an error mesurement. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if the stream is null. |
SetValue<TValue>(LiveStream, LivePropertyHandle, in TValue)
Sets the value of the property associated with the specified LivePropertyHandle.
Declaration
public static void SetValue<TValue>(this LiveStream stream, LivePropertyHandle handle, in TValue value)
where TValue : struct
Parameters
| Type | Name | Description |
|---|---|---|
| LiveStream | stream | The stream containing the property. |
| LivePropertyHandle | handle | The LivePropertyHandle representing the property. |
| TValue | value | The value to set to the property. |
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of the data to retrieve. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if the stream is null. |
TryGetHandle(LiveStream, String, String, Type, out LivePropertyHandle)
Attemps to retrieve an already created property from the stream.
Declaration
public static bool TryGetHandle(this LiveStream stream, string relativePath, string propertyName, Type type, out LivePropertyHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| LiveStream | stream | The stream to create the property to. |
| String | relativePath | The path from the root transform where the component to bind to is. |
| String | propertyName | The name of the property to bind to. |
| Type | type | The type of the component to bind to. |
| LivePropertyHandle | handle | The returned property handle instance, or default if the property handle was not found. |
Returns
| Type | Description |
|---|---|
| Boolean |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if the stream is null. |
TryGetHandle(LiveStream, String, Type, out LivePropertyHandle)
Attemps to retrieve an already created property from the stream at the root transform.
Declaration
public static bool TryGetHandle(this LiveStream stream, string propertyName, Type type, out LivePropertyHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| LiveStream | stream | The stream to create the property to. |
| String | propertyName | The name of the property to bind to. |
| Type | type | The type of the component to bind to. |
| LivePropertyHandle | handle | The returned property handle instance, or default if the property handle was not found. |
Returns
| Type | Description |
|---|---|
| Boolean |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if the stream is null. |
TryGetValue<TValue>(LiveStream, LivePropertyHandle, out TValue)
Attempts to get the value of the property associated with the specified LivePropertyHandle.
Declaration
public static bool TryGetValue<TValue>(this LiveStream stream, LivePropertyHandle handle, out TValue value)
where TValue : struct
Parameters
| Type | Name | Description |
|---|---|---|
| LiveStream | stream | The stream containing the property. |
| LivePropertyHandle | handle | The LivePropertyHandle representing the property. |
| TValue | value | The value stored in the property. |
Returns
| Type | Description |
|---|---|
| Boolean |
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of the data to retrieve. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if the stream is null. |