ResourceLoader scans folders and all types of resources in Resources folder and then generates a C# script that contains structs and enums based on it.
With this, you can load resources simply by calling the ResourceLoader after a single drag'n drop into your Resources folder:
Instantiate(ResourceLoader.GetResource<GameObject>(Prefabs.UI.SpawnButton_1));
SetMaterial(ResourceLoader.GetResource<Material>(Materials.Tree_1));
This is designed specifically for my simple projects.
- Compared to Asset Bundle or Addressable, this is more suitable for personal learning projects.
- I made this in order to streamline the process of loading assets.
- You can see the whole code from my RTS project.
- Place any resources you want to access at runtime through ResourceLoader.cs into your Resources folder.
- Open the editor window(Window -> Custom Asset Window) and drag'n drop your script that you want to add enums to.
- Based on your folder structure, After clicking Save Button in the editor window, your script will automatically be edited with corresponding enums inside.
- Now you can load your resources by calling
ResourceLoader.GetResource<T>(Enum enumMember);

// This script's automatically generated by EnumGenerator.cs
namespace CustomResourceManagement
{
public enum Materials{
Tree_1,
Tree_2,
}
public struct Prefabs{
public struct Playable{
public enum Unit{
Wizard,
Gladiator,
Dragon,
}
}
public enum UI{
SpawnButton_1,
}
}
public struct Textures{
public enum UI{
Health,
}
}
}