/// <summary> /// Loads current resources. /// </summary> public static void Load(bool forced = false) { if (ResourcesLoaded && !forced) { return; } var progressBarTitle = "Loading JEM Editor Resources."; EditorUtility.DisplayProgressBar(progressBarTitle, "Getting icons", 0f); JEMEditorDownloader.NewRequest("https://i.imgur.com/MtJMl05.png", texture => { JEMIconTexture = texture; }); EditorUtility.ClearProgressBar(); ResourcesLoaded = true; }
/// <summary> /// Creates new request. /// </summary> public static void NewRequest(string url, JEMEditorDownloaderCallback callBack) { var local = LoadFromFile(url); if (local != null) { JEMLogger.InternalLog( $"JEMEditor is getting texture from {url}. Local texture exist! WWW download process will be ignored."); callBack?.Invoke(local); } else { JEMLogger.InternalLog($"JEMEditor is getting texture from {url}"); var d = new JEMEditorDownloader { URL = url, www = new WWW(url), Callback = callBack }; EditorApplication.update += d.Update; } }