I'm trying to load a Texture
from the Resources
folder but it keeps on returning null
.
t = (Texture)Resources.Load("Circle") as Texture;
The circle texture has an extension of .tga
.
I'm trying to load a Texture
from the Resources
folder but it keeps on returning null
.
t = (Texture)Resources.Load("Circle") as Texture;
The circle texture has an extension of .tga
.
You must put Circle.tga in Assets/Resources folder. Plus if you have subfolder, for example Resources/Textures/Circle.tga then do like this:
Texture t = Resources.Load("Textures/Circle") as Texture;
The extension of the file isn't necessary. So this is correct:
t = (Texture)Resources.Load("Circle") as Texture;
This is not:
t = (Texture)Resources.Load("Circle.npg") as Texture;
Texture File should be added into Resources folder After that use below lines of code for load texture
var Texture_1 : Texture2D;
Texture_1 = Resources.Load("TextureName");
Folder should be in kept into Resources folder After that use below lines of code for load folder of textures
var textures : Object[];
textures = Resources.LoadAll("FolderName");
@Massimiliano Uguccioni thanks... that fixed my problem.
Steps to use Resources.load:
© 2022 - 2024 — McMap. All rights reserved.