Method WhenResident
WhenResident<T>(string, Action<T>)
"Give me this when it is ready" — the deferred form of Get<T>(string), and the answer to a synchronous miss.
onReady runs IMMEDIATELY (same frame, no await, no change in ordering) when the
asset is already resident, which is the normal case for anything the boot stage or an active scope
acquired. Only a miss pays for a load, and it pays with a callback instead of a blocked frame — which
is what lets a spawner keep its "spawn now" shape without requiring the asset to be resident in
advance.
A load that fails does not call back at all: the caller sees nothing spawn, and the error is loud. Silence here would be a monster that never appears with nothing in the log to explain it.
public static void WhenResident<T>(string address, Action<T> onReady) where T : Object
Parameters
Type Parameters
T