---
url: https://cri-middleware.github.io/SSPlayerForWeb/api/@spritestudio/ssplayer-pixi/interfaces/IResourceManager.md
---
# Interface: IResourceManager

Defined in: packages/ssplayer-core/dist/index.d.ts:2610

## Methods

### clearOverrideTexture()?

> `optional` **clearOverrideTexture**(`hash`): `void`

Defined in: packages/ssplayer-core/dist/index.d.ts:2652

Optional: drop any override for `hash`, restoring the originally loaded
texture. A no-op when nothing is overridden. Pairs with
[setOverrideTexture](#setoverridetexture).

#### Parameters

##### hash

`number`

#### Returns

`void`

***

### destroy()

> **destroy**(): `void`

Defined in: packages/ssplayer-core/dist/index.d.ts:2669

Frees all managed resources.

#### Returns

`void`

***

### getOverrideTexture()?

> `optional` **getOverrideTexture**(`hash`): `unknown`

Defined in: packages/ssplayer-core/dist/index.d.ts:2657

Optional: the current override for `hash` (the caller-supplied value, not
the original texture), or `undefined` when nothing is overridden.

#### Parameters

##### hash

`number`

#### Returns

`unknown`

***

### getTexture()

> **getTexture**(`hash`): `any`

Defined in: packages/ssplayer-core/dist/index.d.ts:2632

Gets a loaded texture by its hash.

#### Parameters

##### hash

`number`

The hash of the texture.

#### Returns

`any`

The engine-specific texture object (e.g. PIXI.Texture).

***

### loadTexture()

> **loadTexture**(`url`, `hash`): `Promise`<`void`>

Defined in: packages/ssplayer-core/dist/index.d.ts:2616

Loads a texture from the given URL and associates it with the given hash.

#### Parameters

##### url

`string`

The URL of the texture to load.

##### hash

`number`

The cell-map name hash — a slot in one `.ssab`, not an image.

#### Returns

`Promise`<`void`>

***

### loadTextureFromBytes()?

> `optional` **loadTextureFromBytes**(`bytes`, `hash`): `Promise`<`void`>

Defined in: packages/ssplayer-core/dist/index.d.ts:2626

Optional: bind a texture from raw (encoded) image bytes — e.g. a PNG/JPEG
embedded in the SSAB (`--embedded` converter mode) — and associate it with
the given hash. ResourceManagers that only support URL loading may omit
this; the core then falls back to [loadTexture](#loadtexture) with a resolved file
URL, so embedded textures require this method to render.

#### Parameters

##### bytes

`Uint8Array`

The encoded image bytes (e.g. a PNG/JPEG file's contents).

##### hash

`number`

The hash of the texture (cell-map name hash).

#### Returns

`Promise`<`void`>

***

### reset()?

> `optional` **reset**(): `void`

Defined in: packages/ssplayer-core/dist/index.d.ts:2665

Optional: forget every texture bound for the previously bound pack, so the
next one loads its own from scratch. Called by the core from
`bindResource`; a manager that caches by hash must implement it. Must also
drop any runtime texture overrides — they belong to the previous pack's
hashes.

#### Returns

`void`

***

### setOverrideTexture()?

> `optional` **setOverrideTexture**(`hash`, `texture`): `void`

Defined in: packages/ssplayer-core/dist/index.d.ts:2646

Optional: replace the texture bound to `hash` with a caller-supplied engine
texture (runtime texture replacement — costume/expression swaps). The
override *shadows* the originally loaded texture rather than freeing it, so
[clearOverrideTexture](#clearoverridetexture) can restore the original with no reload. The
override object is caller-owned; managers that build their own from a raw
source track that separately and free only what they built.

A manager without this method cannot be a texture-replacement target, and
the core throws a clear error rather than silently no-op.

#### Parameters

##### hash

`number`

The render-time texture key (cell-map or external-texture name hash).

##### texture

`unknown`

The engine-specific texture object (e.g. PIXI.Texture).

#### Returns

`void`
