- Home /
Resources.load absolute path
Hello, i like to import something from under the assets folder.
something like:
fmitem.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("c:/Living.png");
Is this possible? Unity does not seem to find it this way
Answer by Fattie · Jan 16, 2016 at 07:16 PM
note that it must be inside your Resource folder.
you can possibly do what you're trying to achieve using the WWW call
http://answers.unity3d.com/questions/517414/how-to-use-www-to-load-local-files.html
http://answers.unity3d.com/questions/813495/can-i-load-textures-outside-the-resources-folder.html
http://answers.unity3d.com/questions/14587/load-texture-at-run-time-from-file.html
Answer by Danixos · Jan 18, 2016 at 05:42 PM
Resources.Load() resolves all paths relative to <projectRoot>/Assets/Resources/ directory.
Create the Resourcesdirectory if it doesn't already exists and move any assets that you want to load there. They can be in a subdirectory. Up to you.
Assuming you put Living.png in Resources/, call Resources.Load<Sprite>("Living") and you should get your asset. Note that you must leave off the file extension. Thus Living.png becomes Living.
HTH
Your answer
Follow this Question
Related Questions
Another animation is not working 0 Answers
Meaning of .text 1 Answer
Get Component Error 1 Answer
Getcomponent what do i wrong? 2 Answers