GetMainTexture2D.cs 655 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5. using UnityEngine.UI;
  6. public class GetMainTexture2D : MonoBehaviour
  7. {
  8. public string m_url = "";
  9. void Start()
  10. {
  11. string filePath = System.IO.Path.Combine(Application.streamingAssetsPath+"/Main", m_url);
  12. SetWebGLText.Instance.GetTexture(filePath+".png", (Texture2D t2d)=> {
  13. try
  14. {
  15. if (GetComponent<RawImage>())
  16. GetComponent<RawImage>().texture = t2d;
  17. }
  18. catch
  19. {
  20. }
  21. });
  22. }
  23. }