- Home /
Resourse.Load randomly fails on android device
I'm making a game for android. I'm using Resources.Load which works fine in the editor and on almost every device I've tested. The device in question is the Samsung Note 4 which Resources.Load will randomly fail.
When it fails, I have to uninstall the game and rebuild to this device. Sometimes Resources.Load will work and other times it might not. I've used Resources.Load many times before and am pointing to the correct path with no type extension in the path, plus it works every time except on this device.
I've searched google far and wide and cannot find an answer that has fixed the issue.
I'm using Unity 2018.1.4f1 and the android device is Samsung Note 4.
What do you mean it randomly fails? Does it return a null object when it fails? $$anonymous$$aybe just a redundancy?
myObj = Resources.Load<$$anonymous$$yObjType>("objName");
if (myObj == null)
{
myObj = Resources.Load<$$anonymous$$yObjType>("objName");
}
Also I've read sometimes issues can be caused by old meta files or something, it may be pertinent to create a new copy of the prefab and try again.
When I say randomly fails, I mean sometimes Resources.Load will load the object properly and other times it will return null, but only on the single device. All other devices work fine.
myObj = Resourses.Load<Type>(path);
if (myObj == null)
{
Debug.LogError("$$anonymous$$y Obj is null!");
return;
}
Sometimes myObj will be null and the error is displayed. Other times it's not null and the code continues on.
Your answer
![](https://koobas.hobune.stream/wayback/20220612191644im_/https://answers.unity.com/themes/thub/images/avi.jpg)