- Home /
Can't find texture file path using Resources.Load()
I can't seem to get this working. The file is in the specified folders with the correct name and this always returns null.
Can anyone tell me what I'm doing wrong? This is in JS.
function OnDrawGizmos () {
var MyTexture : Texture2D = Resources.Load("Assets/Resources/EditorIcons/TimeEventIcon.png") as Texture2D;
Gizmos.DrawGUITexture(Rect(0, 0, 20, 20), MyTexture);
//Gizmos.DrawGUITexture(Rect(0, 0, 20, 20), Resources.Load("Assets/Resources/EditorIcons/TimeEventIcon") as Texture2D);
}
Comment
Answer by pishock · Mar 19, 2014 at 03:55 PM
The path should be relative to the Resources
folder and without an extension.
Try using
Resources.Load("EditorIcons/TimeEventIcon")
Refer to the manual here: Resources.Load
Your answer
Follow this Question
Related Questions
Load a jpeg from the users drive to use as a texture in a standalone build? 1 Answer
How to supress a # into a path string 1 Answer
How to get Assets path and to load an asset with out AssetsDatabase? 2 Answers
Resources.Load(path+name) as texture == null reference 7 Answers
Does reference to Texture count on RAM usage of device? 0 Answers