12345678910111213141516171819202122 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
- using UnityEngine.UI;
- [ExecuteInEditMode]
- public class GetTexture2D : MonoBehaviour
- {
- public string m_url = "";
- // Start is called before the first frame update
- void Start()
- {
- // 启动协程进行图片下载
- SetWebGLText.Instance.GetTexture(m_url, (Texture2D t2d)=> {
- // 将纹理设置到RawImage组件中显示
- GetComponent<RawImage>().texture = t2d;
- });
- }
- }
|