Skip to content

Resources.Load โ€‹

Namespace: Cwl.Patches.Relocation;

A custom unity Resources.Load fallback handler.

Relocate โ€‹

Your loader must use the following signature:

cs
static bool RelocateXXX(string path, ref Object? loaded)

If you are able to resolve the path and load the resource, assign the value to the ref Object? loaded and return true, otherwise do nothing and return false.

Register โ€‹

Then register with CWL:

cs
LoadResourcesPatch.AddHandler<T>(RelocateXXX);

CWL internally uses RelocateSound and RelocateSprite for external sound files and sprite files lookup.

cs
LoadResourcesPatch.AddHandler<SoundData>(DataLoader.RelocateSound);
LoadResourcesPatch.AddHandler<Sprite>(DataLoader.RelocateSprite);