Unity关于本地加载图片的有2种,一种使用webrequest发送请求发送数据将得到的数据转换成Texture2d,最后转换成sprite,第二种方法是使用读取文本文件方法
将图片当成文件来读取,然后转换成,下边附上我的代码文章来源地址https://www.toymoban.com/news/detail-554913.html
[RequireComponent(typeof(UnityEngine.UI.Image))]
public class LoadMyUI : MonoBehaviour
{
public string path = " ";
private string Currentpath = " ";
private Image thisImage;
public string MySaveTextName = " ";
private string SaveImageTxtName = " ";
private TagIsDepress Tag;
private bool LoadingEnd = false;
// Start is called before the first frame update
void Start()
{
thisImage = this.GetComponent<Image>();
//thisImage.gameObject.SetActive(false);
Currentpath = Path.Combine(Application.persistentDataPath, path);
Debug.Log($"PathpersistentDataPathYouSEE:
文章来源:https://www.toymoban.com/news/detail-554913.html
到了这里,关于Unity关于本地加载图片涉及webrequest或者byte的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!