UnityMessageBatcher class

Message batcher for high-frequency Unity communication.

Coalesces multiple messages into single batched transmissions to reduce overhead for high-frequency updates.

Example:

final batcher = UnityMessageBatcher(controller);
batcher.configure(maxBatchSize: 50, flushIntervalMs: 16);

// In update loop - messages are batched automatically
batcher.queue('Player', 'position', {'x': 1.0, 'y': 2.0});

Constructors

UnityMessageBatcher(UnityController _controller)

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
statistics → BatcherStatistics
Get batching statistics.
no setter

Methods

configure({int? maxBatchSize, int? flushIntervalMs, bool? enabled, bool? enableCoalescing}) → void
Configure batching parameters.
dispose() → void
Dispose the batcher and cancel any pending operations.
flush() → Future<void>
Immediately flush all pending messages.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queue(String target, String method, dynamic data) → void
Queue a message for batched sending.
queueBinary(String target, String method, List<int> data) → void
Queue a binary message for batched sending.
resetStatistics() → void
Reset statistics.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited