在纹理调用Resources.Load不工作 [英] Calling Resources.Load on a texture is not working

查看:141
本文介绍了在纹理调用Resources.Load不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图加载纹理资源文件夹,但它一直在返回无效

I'm trying to load a Texture from the Resources folder but it keeps on returning null.

t = (Texture)Resources.Load("Circle") as Texture;



圆纹理有 .TGA 。

推荐答案

纹理文件应加进入资源文件夹
下面的代码行的使用负载质感

Single Texture File

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");



有关文件夹



文件夹应该在一直到资源文件夹
下面的纹理负载文件夹中的代码行使用后

For Folder

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");

这篇关于在纹理调用Resources.Load不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆