Cannot use string variable for path in Resources.Loadall
I need to load assets depending on which character is chosen. If I use a variable string (path), Resources.LoadAll does not work. If the string is placed directly in the method where the variable "path" is then it works.
Does not work: public void FindMaterials() { string path = "Models / Gail / Materials"; materialsThatHaveBeenFound = (Material[])Resources.LoadAll(path, typeof(Material)).Cast().ToArray(); }
Works: public void FindMaterials() { materialsThatHaveBeenFound = (Material[])Resources.LoadAll("Models / Gail / Materials", typeof(Material)).Cast().ToArray(); }
Answer by cansub · May 17, 2018 at 12:31 PM
It does work. For some reason it was placing spaces in my variable...
Your answer
Follow this Question
Related Questions
Resources.LoadAll() error in WebGL 0 Answers
Failed to re-package resources 0 Answers
Score/Resource Counter 1 Answer
Keep a file from assets after build 0 Answers
Hot to buid without Resourses folder? 0 Answers