Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


OnMessage(RealtimeMessageContext, Pipe, Message)

Called immediately from RealtimeContext.SendMessage when a message was sent to this ProcessorInstance on the real-time side.
Read time 1 minuteLast updated 8 days ago

Definition

ProcessorInstance.Response OnMessage(RealtimeMessageContext context, ProcessorInstance.Pipe pipe, ProcessorInstance.Message message)

Parameters

A RealtimeMessageContext giving cross-thread data communication via
pipe
(but no nested processing).

pipe

Cross-thread communications pipe.

message

The message someone sent to you through RealtimeContext.SendMessage. The contents are sent by reference, so you can modify them and the sender will see the changes.

Returns

Type

Description

ResponseProcessorInstance.Response.Handled if this ProcessorInstance acknowledged and processed the message, ProcessorInstance.Response.Unhandled if not or ignored.

Remarks

This is the real-time counterpart of ProcessorInstance.IControl<TRealtime>.OnMessage. It runs synchronously on the real-time thread, within the originating RealtimeContext.
This has a default implementation returning ProcessorInstance.Response.Unhandled, so existing ProcessorInstance.IRealtime implementations remain source-compatible; override it to handle real-time messages. Since overriding default methods isn't positively constrained by the compiler, you may find it helpful to implement such interface methods explicitly
Additional Resources: RealtimeContext.SendMessage