- Home /
Load texture and shaders at runtime on iPhone
Hello, everyone.
I have a trouble with dynamical loading resources. I have to change the texture of the object at runtime, so I've placed the textures under Resources folder and could load them dynamically in Game window. But when I build and deploy the app into my iPhone, they couldn't be loaded and the object has no texture at all.
This is the same for shaders. So I've thought that the Resources folder didn't work for me. I'm not sure what I'm doing wrong.
Looking forward to hear any advices from you. Thanks.
Answer by Eric5h5 · Aug 28, 2012 at 05:40 AM
How are you loading them? If you're treating them as actual files and using System. IO classes, the Resources folder does not exist in a build; it's just a collection of assets in a file. So you have to use Resources.Load.
Hello, Eric.
I'm using Resources.Load function but I couldn't load them.
Answer by Qibo F. · Sep 01, 2012 at 05:56 AM
So, I've solved this problem at all. I've linked those textures and shaders to my materials in the scenes as well as putting them under Resources folder. This is very strange but I think that unity is unloading them at runtime.
Anyhow, I hope this will help someone who has similar problems. :) Thanks, Pei.