Class ConnectionManager
The class that manages Connection and serializes instances.
Inherited Members
Namespace: Unity.LiveCapture
Syntax
public class ConnectionManager : ScriptableObject
Properties
Connections
The connection instances.
Declaration
public IEnumerable<Connection> Connections { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Connection> |
Instance
The ConnectionManager instance.
Declaration
public static ConnectionManager Instance { get; }
Property Value
Type | Description |
---|---|
ConnectionManager |
Methods
CreateConnection(Type, Boolean)
Creates a Connection of a specified type.
Declaration
public Connection CreateConnection(Type type, bool registerUndo = true)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type of connection to create. |
Boolean | registerUndo | When true, allows the user to undo creating the connection. |
Returns
Type | Description |
---|---|
Connection | The connection instance. |
Remarks
You should create only one instance of each connection at a time.
If a connection of type type
already exists, the
method returns this existing connection instead of a new instance.
DestroyConnection(Connection, Boolean)
Destroys a Connection.
Declaration
public void DestroyConnection(Connection connection, bool registerUndo = true)
Parameters
Type | Name | Description |
---|---|---|
Connection | connection | The connection to destroy. |
Boolean | registerUndo | When true, allows the user to undo destroying the connection. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if |
HasConnection(Type)
Checks if a Connection of a specified type exists.
Declaration
public bool HasConnection(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type of connection to look for. |
Returns
Type | Description |
---|---|
Boolean | true if a connection of the specified type exists; otherwise, false. |
TryGetConnection<TConnection>(out TConnection)
Gets the Connection of a specified type, if it exists.
Declaration
public bool TryGetConnection<TConnection>(out TConnection connection)
where TConnection : Connection
Parameters
Type | Name | Description |
---|---|---|
TConnection | connection | The returned connection, or langword_csharp_default if there is no matching connection instance. |
Returns
Type | Description |
---|---|
Boolean | true if a matching connection instance was found; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TConnection | The type of the connection to get. |
Events
ConnectionAdded
An event invoked when a Connection is added.
Declaration
public static event Action<Connection> ConnectionAdded
Event Type
Type | Description |
---|---|
Action<Connection> |
ConnectionRemoved
An event invoked when a Connection is removed.
Declaration
public static event Action<Connection> ConnectionRemoved
Event Type
Type | Description |
---|---|
Action<Connection> |