Subfolders with Resources.Load not working

It seems that using subfolders inside Resources no longer works with Resources.Load

Examples:

Works:

var ind = Instantiate(Resources.Load(“Indicator”, typeof(GameObject))) as GameObject;

Folder structure:

Resources
— Indicator.prefab

According to this and a few other sources, this should work, yet it doesn’t:

var ind = Instantiate(Resources.Load(“UI/Indicator”, typeof(GameObject))) as GameObject;

Folder structure:

Resources
— UI
— — Indicator.prefab

The documentation says:

The path is relative to any Resources folder inside the Assets folder of your project, extensions must be omitted.

If it’s relative, then it should be working.

The only other way I’ve found to be able to organize the assets is to put a “Resources” folder inside every asset category. This really doesn’t seem ideal to me, and will most likely result in a mess:

var ind = Instantiate(Resources.Load(“Indicator”, typeof(GameObject))) as GameObject;

Folder structure:

Resources
— UI
— — Resources
— — — Indicator.prefab

Does Unity really not support subfolders inside Resources anymore? Or am I doing something wrong? I’ve been trying to wrap my head around something I must be doing wrong, but it’s getting quite frustrating and I’ve found no reason for it not to work.

Additionally, I’ve tried posting this issue on the Unity Support forum, but everytime I click on Submit New Thread, it does nothing and takes me to the forum.

Loading resources from subfolders works fine for me in Unity 3.5 and Unity 4.

What about trying to break down each step?

Object o = Resources.Load("UI/Indicator");
if (o == null) Debug.Log("Load failed");

GameObject go = o as GameObject;
if (go == null) Debug.Log("Loaded object isn't GameObject");

GameObject ind = Instantiate(go) as GameObject;
if (ind == null) Debug.Log("Couldn't instantiate");

I’m guessing that one of the first two Debug.Log lines will report, and you’ll be able to narrow down the issue.

just for the record: if you have another resource with the same name (different extension) in the same folder the Resource.Load will always return NULL, just realized after hours of struggle with this. In my particular case:

transition_bar.png

transition_bar.prefab → transition_bar_pfb.prefab