Problem with Resources.Load in Android
I want to load some materials to some planes for my android app. What confusing me is that it done perfectly fine in the unity editor; but when I build the app on the mobile, the materials cannot be loaded.
Here is the code:
public class myCreatures
{
public static void changeMat(int ID, GameObject obj){
Material creMat = Resources.Load ("Creatures/" + ID, typeof(Material)) as Material;
obj.GetComponent<Renderer> ().sharedMaterial = creMat;
}
}
I searched for some discussion, some said that resources.load can only work as preload during initialization, but some said direct call is needed. Anyway I tried to preload the materials when the app starts. It also works in the editor, but failed in the mobile device as well.
Basically it works perfectly fine in the unity editor, but fails mostly when building to the mobile. (Interestingly there are some cases within the same app succeeds in loading the materials on mobile, by calling the same function stated above, but I can't figure out what is the differences)
Can anyone suggest me some help? Thanks in advance.
$$anonymous$$aterials in general or the texture attached to it might not be serializable. Checklist: https://blogs.unity3d.com/2014/06/24/serialization-in-unity/
Sorry I discovered some problem in the previous lines, these lines are okay.
Your answer
Follow this Question
Related Questions
Screenshot on Android 2 Answers
user can't log into google play services 1 Answer
Determine Wifi adapter address on Android 0 Answers
How do I destroy an audio when a specific scene is loaded 0 Answers
Admob Rewarded Video ads source code,Admob Rewarded Video Ads for android game : Source Code 0 Answers