- Home /
Resources.Load folders path?
Hi, Im trying to load a resource Textures with script, this works ok except that i cant load the texture from a folder called "letters" that i put inside Recourses. How can i set the folder path ? Also, will this work with a String variable ?
renderer.material.mainTexture = Resources.Load("StringVar\AaLetter"); ?????
TY
Comment
Best Answer
Answer by Rod-Green · Dec 28, 2011 at 05:27 AM
if StringVarAaLetters is in the path "Resources/letters/StringVarAaLetter":
string texturePath = "letters/StringVarAaLetter";
renderer.material.mainTexture = (Texture)Resources.Load(texturePath, typeof(Texture));
Answer by Dev_alx · Feb 21, 2018 at 10:09 AM
You can do this (with the newer version of unity) :
string texturePath = "letters/StringVarAaLetter";
renderer.material.mainTexture = Resources.Load<Texture>(texturePath);
Your answer
Follow this Question
Related Questions
Loading in Sprites outside of unity? 1 Answer
Get path to loaded resource. 1 Answer
Resources.Load dynamic path 2 Answers
Get resource path 3 Answers