Extend to implement custom resources.

The loader-id is the used to ensure that we can load the same assets out of different contexts. For each loader-id there can only be one loader.

Loaders can be build for specific game needs.

Overwrite unload to release GPU objects.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods

  • Implement here your custom loading and parsing parts.

    Use this.manager to access the resource manager and use existing loaders to get things done fast and easy.

    // Example:
    // 1. uses TextLoader to load the json raw string data
    // 2. parses the raw text to json
    load(path:string):Promise<any> {
    return this.manager.request<string>(`text:${path}`)
    .then(jsonStr => {
    try {
    const json = JSON.parse(jsonStr);
    return Promise.resolve(json);
    }
    catch(err) {
    throw new Error(`Cannot parse json from ${path}. Reason: ${(err as any).message}`);
    }
    });
    }

    Parameters

    • path: string

      is only the path part. There is NO loader-id here.

    • loader: SubResourceLoader

    Returns Promise<any>

Generated using TypeDoc