Struct MessageContext
A context provided to a node's Unity.DataFlowGraph.NodeDefinition.OnMessage``1(Unity.DataFlowGraph.MessageContext@,``0@) implementation which is invoked when a node receives a message on one of their MessageInputs.
Inherited Members
Namespace: Unity.DataFlowGraph
Syntax
public struct MessageContext
Fields
Set
The NodeSetAPI associated with this context.
Declaration
public readonly NodeSetAPI Set
Field Value
Type | Description |
---|---|
NodeSetAPI |
Properties
ArrayIndex
If the above port ID corresponds to a PortArray<TPort>, this is the array index on which the message is being received.
Declaration
public ushort ArrayIndex { get; }
Property Value
Type | Description |
---|---|
UInt16 |
Handle
A handle to the node receiving a message.
Declaration
public NodeHandle Handle { get; }
Property Value
Type | Description |
---|---|
NodeHandle |
Port
The port ID of the MessageInput<TDefinition, TMsg> on which the message is being received.
Declaration
public InputPortID Port { get; }
Property Value
Type | Description |
---|---|
InputPortID |
Methods
EmitMessage<T, TNodeDefinition>(MessageOutput<TNodeDefinition, T>, T)
Emit a message from yourself on a port. Everything connected to it will receive your message.
Declaration
public void EmitMessage<T, TNodeDefinition>(MessageOutput<TNodeDefinition, T> port, in T msg)
where TNodeDefinition : NodeDefinition
Parameters
Type | Name | Description |
---|---|---|
MessageOutput<TNodeDefinition, T> | port | |
T | msg |
Type Parameters
Name | Description |
---|---|
T | |
TNodeDefinition |
EmitMessage<T, TNodeDefinition>(PortArray<MessageOutput<TNodeDefinition, T>>, Int32, T)
Emit a message from yourself on a port array. Everything connected to it will receive your message.
Declaration
public void EmitMessage<T, TNodeDefinition>(PortArray<MessageOutput<TNodeDefinition, T>> port, int arrayIndex, in T msg)
where TNodeDefinition : NodeDefinition
Parameters
Type | Name | Description |
---|---|---|
PortArray<MessageOutput<TNodeDefinition, T>> | port | |
Int32 | arrayIndex | |
T | msg |
Type Parameters
Name | Description |
---|---|
T | |
TNodeDefinition |
RegisterForUpdate()
Registers Handle for regular updates every time Update() is called. This only takes effect after the next Update(). Update(UpdateContext) RemoveFromUpdate()
Declaration
public void RegisterForUpdate()
Remarks
A node will automatically be removed from the update list when it is destroyed.
Exceptions
Type | Condition |
---|---|
InvalidNodeDefinitionException | Will be thrown if the Handle does not support updating. |
InvalidOperationException | Thrown if Handle is already registered for updating. |
RemoveFromUpdate()
Deregisters Handle from updating every time Update() is called. This only takes effect after the next Update(). RegisterForUpdate()
Declaration
public void RemoveFromUpdate()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if Handle is not registered for updating. |
SetKernelBufferSize<TGraphKernel>(TGraphKernel)
Set the size of a Buffer<T> appearing in this node's IGraphKernel<TKernelData, TKernelPortDefinition>.
Pass an instance of the node's IGraphKernel<TKernelData, TKernelPortDefinition> as the requestedSize
parameter with Buffer<T> instances within it having been set using SizeRequest(Int32).
Any Buffer<T> instances within the given struct that have not been set using
SizeRequest(Int32) will be unaffected by the call.
Declaration
public void SetKernelBufferSize<TGraphKernel>(in TGraphKernel requestedSize)
where TGraphKernel : IGraphKernel
Parameters
Type | Name | Description |
---|---|---|
TGraphKernel | requestedSize |
Type Parameters
Name | Description |
---|---|
TGraphKernel |
UpdateKernelData<TKernelData>(TKernelData)
Updates the associated TKernelData
asynchronously,
to be available in a IGraphKernel in the next render.
Declaration
public void UpdateKernelData<TKernelData>(in TKernelData data)
where TKernelData : struct, IKernelData
Parameters
Type | Name | Description |
---|---|---|
TKernelData | data |
Type Parameters
Name | Description |
---|---|
TKernelData |