Resources.Load and dynamic loading when call to
Hello all. Help me please. I create little html5 game and I try to reduce loading time (first loading screen). So I use Resources.Load to load resorces when call to, not in game start.
I try to make simple example:
public GameObject Cube_01;
public void UploadTexture (){
Cube_01.GetComponent<Renderer>().material.mainTexture = Resources.Load<Texture2D>("Kitten_01");
}
In this example I create cube with some texture and button. When I click button it call UploadTexture () and load texture "Kitten_01" from resources.
I thoute that Resources.Load method will load texture ("Kitten_01" in the example) only when call. Instead it has loading this texture in game start (in first loadin screen). Please tell me, that I do wrong, and what I need to do to load textures not in game start but when it needet for.
How are you sure that it is loading at the start? Also, are you sure that you are not calling this function at the start?
Answer by MasterKolobok · May 26, 2020 at 09:44 AM
Hello @KoenogX3. I know, that all resources is loaded at start because of loading time. I make texture, that called by Resources.Load with big size + Debug.Log on every stage to know all time periods. So I saw, that first loading is still long, but Resource.Load is working instantly. And also I call function with Resources.Load only with button, so I think it make this call not in start. But it not working, because of that I realy need help...
Your answer
Follow this Question
Related Questions
results -> dynamics.bounds error 0 Answers
Best way to serialize a big array of a class 2 Answers
Saving/loading inherited class scripts (C#) 1 Answer
BinaryFormatter - Save and Load lists of data? 0 Answers
Dynamic Menu C# 0 Answers