Unity API Reference¶
-
public class
ComponentAttribute
¶ -
public string
Name
{ get; set; } ¶ The name of the Blender component (required).
-
public string
-
public interface
IComponent
¶ Interface for a third party components. When added to a
MonoBehaviour
this adds extension methods for Coherence events and vertex streams.-
public void
AddHandler<T>
(stringid
, Action<string, T>callback
)¶ Add an event handler for when Blender sends a custom message for this object (e.g. through a matching Blender component)
id: Unique event- IDcallback: Action to execute in response to the event from Blender
-
public void
RemoveHandler<T>
(stringid
, Action<string, T>callback
)¶ Remove a callback previously added with
AddHandler<T>
id: Unique event- IDcallback: Action to remove
-
public void
RemoveAllHandlers
()¶ Remove all callbacks for inbound events
-
public void
SendEvent<T>
(stringid
, Tpayload
)¶ Send an arbitrary block of data to Blender.
Data sent will be associated with this object on the Blender side through a matching SceneObject plugin kind.
id: Unique event IDpayload: Serializable struct instance of T to send to Blender
-
public void
AddVertexDataStream<T>
(stringid
, Action<string, Mesh, ArrayBuffer<T>>callback
)¶ Add a callback to be executed every time vertex data is synced.
The callback receives the Unity
Mesh
that was updated and anArrayBuffer
containing the custom per-vertex data generated from Blender.The number of elements in the buffer match the number of vertices in the Unity
Mesh
. When compressing loop elements down to unique vertices, the source buffer from Blender will also be compressed the same way to generate unique per-vertex elements.This is unlike
Component.add_custom_vertex_data_stream()
where the stream must contain the same number of elements as there are loops in the evaluated Blender mesh.id: Unique stream IDcallback: Callback method to execute when receiving stream updates from Blender.
-
public void
RemoveVertexDataStream
(stringid
)¶ Remove a previously registered vertex data stream handler
id: Unique stream ID
-
private void
Start
()¶ Standard Unity
MonoBehaviour.Start
method.This is equivalent to
Component.on_create()
-
private void
OnDestroy
()¶ Standard Unity
MonoBehaviour.OnDestroy
method.This is equivalent to
Component.on_destroy()
-
private void
OnEnable
()¶ Standard Unity
MonoBehaviour.OnEnable
method.This is equivalent to
Component.on_enable()
-
private void
OnDisable
()¶ Standard Unity
MonoBehaviour.OnDisable
method.This is equivalent to
Component.on_disable()
-
private void
OnRegistered
()¶ Called when the plugin is added to the registered plugins list
Equivalent to
Component.on_registered()
-
private void
OnUnregistered
()¶ Called when the plugin is removed from the registered plugins list
Equivalent to
Component.on_unregistered()
-
private void
OnCoherenceEnabled
()¶ Called when the Coherence connection has been enabled.
Equivalent to
Component.on_coherence_enabled()
-
private void
OnCoherenceDisabled
()¶ Called when the Coherence connection is disabled.
Equivalent to
Component.on_coherence_disabled()
-
private void
OnCoherenceConnected
()¶ Perform any additional work after Coherence establishes a connection
Equivalent to
Component.on_coherence_connected()
-
private void
OnCoherenceDisconnected
()¶ Perform any cleanup after Coherence disconnects from the host.
Equivalent to
Component.on_coherence_disconnected()
-
public void