- Home /
Have some strange problem with Resources.Load
Hello!
I have strange problem with Resources.Load. I have prefab within Resource folder. That prefab loading fine... but not always. Sometimes it load. Sometimes not. I verified what happens and it seems sometimes Resources.Load doesn't see any prefab within resource folder!! I tried load all resources and see what I have:
var objects = Resources.LoadAll("");
string error = "";
foreach (var o in objects)
{
string assetPath = AssetDatabase.GetAssetPath(o);
if (assetPath.Contains("Assets/*****/Resources"))
{
error += $"assetPath {assetPath} Object = {o} \n";
}
}
If all works as it should code show prefabs in selected list. But if Resources.Load failed, in that list I don't see a single prefab.
Any idea what it could be? Unity version 2019.4.16
I'm having the same issue. Did you find a solution / cause? It seems to work for me if I manually move the prefab out of the directory and back in, but it periodically breaks again.
Answer by Gentle-Troll · Apr 02, 2021 at 08:55 AM
I'm having that problem, too. Here is a forum threat with more infos and some solutions: https://forum.unity.com/threads/since-unity-2019-4-15-resources-load-calls-all-fail-until-i-rebuild.1010290/