Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Load()

Loads the object synchronously. Blocks until loading is complete.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Method
  • Namespace: Unity.Loading
  • Assembly: UnityEngine.ContentLoadModule
public T Load()

Returns

Type

Description

TThe loaded object, or
null
if loading failed.

Remarks

Load does not throw when the asset cannot be returned. Instead it returns
null
, logs an error, and sets Loadable<T>.Status to LoadableStatus.Failed. This happens when the asset is not present in any registered content directory, when it has already been released, or when the loaded object cannot be cast to
T
because the Loadable<T>.LoadableObjectId points at an object of an incompatible type.