Advertisement
Avatarchik

Untitled

Jul 25th, 2022
1,185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3.  
  4. public class PhotoLoader : MonoBehaviour
  5. {
  6.     public static PhotoLoader Instance
  7.     {
  8.         get { return PhotoLoader._instance; }
  9.     }
  10.  
  11.  
  12.     private void Awake()
  13.     {
  14.         PhotoLoader._instance = this;
  15.     }
  16.  
  17.  
  18.     public void LoadPhotoAsync(string path, FileLoadUtils.ImageLoaded cb)
  19.     {
  20.         base.StartCoroutine(FileLoadUtils.LoadImageAsync(path, delegate(Texture2D img) { cb(img); }));
  21.     }
  22.     public void LoadPhotoStremmingAssetsAsync(string path, FileLoadUtils.ImageLoaded cb)
  23.     {
  24.         base.StartCoroutine(FileLoadUtils.LoadImageAsync(Application.streamingAssetsPath + path, delegate(Texture2D img) { cb(img); }));
  25.     }
  26.  
  27.  
  28.     private static PhotoLoader _instance;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement