Class AddressableLoadBatch
A single caller's unit of work inside AddressableLoadProcessor. Returned by BeginProcessQueue(), it tracks exactly the items that caller enqueued and raises Completed once those items — and only those items — have finished.
public sealed class AddressableLoadBatch
- Inheritance
-
AddressableLoadBatch
- Inherited Members
Remarks
This type exists to remove completion signalling from the processor's global OnProgressUpdate event. That event is a single multicast delegate shared by every bootstrap system, both loading screens, and the world-scene readiness handshake, so any queue drain finishing anywhere reported "done" to all of them. Worse, a handler that resubscribed during dispatch mutated the invocation list while the runtime was iterating a stale snapshot of it, which could run another subscriber twice.
Each BeginProcessQueue call produces its own batch with its own event,
so callers cannot observe one another's completion and a handler that starts new
work during dispatch is operating on a different object entirely.
A batch counts an item as finished whether it succeeded, failed, or was dropped. Load failures are surfaced through FailedItems rather than by withholding completion — a batch that never completes would stall the caller forever, which is precisely the failure this replaces.
Properties
CompletedItems
Number of items that have finished, successfully or otherwise.
public int CompletedItems { get; }
Property Value
FailedItems
Items in this batch that failed to load. Empty on a fully successful batch.
public IReadOnlyList<string> FailedItems { get; }
Property Value
HasFailures
True when at least one item in this batch failed to load.
public bool HasFailures { get; }
Property Value
IsComplete
True once every claimed item has finished and Completed has been raised.
public bool IsComplete { get; }
Property Value
Progress
Fraction of this batch's items that have finished, in the range 0..1. A batch with nothing to do reports 1.
public float Progress { get; }
Property Value
TotalItems
Total number of items claimed when this batch was created.
public int TotalItems { get; }
Property Value
Events
Completed
Raised exactly once, when the last item in this batch finishes. Handlers added after completion are invoked immediately, so a caller cannot miss the event by subscribing late (a batch whose items were all already loaded completes inside BeginProcessQueue(), before it returns).
public event Action<AddressableLoadBatch> Completed
Event Type
Progressed
Raised as items in this batch finish, with Progress. Not raised after completion; use Completed for the terminal notification.
public event Action<float> Progressed