GetTexture2D.cs 520 B

12345678910111213141516171819
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5. using UnityEngine.UI;
  6. [ExecuteInEditMode]
  7. public class GetTexture2D : MonoBehaviour
  8. {
  9. public string m_url = "";
  10. void Start()
  11. {
  12. string filePath = System.IO.Path.Combine(Application.streamingAssetsPath+"/ui", m_url);
  13. SetWebGLText.Instance.GetTexture(filePath+".png", (Texture2D t2d)=> {
  14. GetComponent<RawImage>().texture = t2d;
  15. },true);
  16. }
  17. }