public static void GetObject(string path, UnityAction <GameObject> action) { var objLoader = new Dummiesman.OBJLoader(); if (path.StartsWith("http")) { var www = UnityEngine.Networking.UnityWebRequest.Get(path); www.SendWebRequest().completed += x => { using (MemoryStream ms = new MemoryStream(www.downloadHandler.data)) action.Invoke(objLoader.Load(ms)); }; } else { action?.Invoke(objLoader.Load(path)); } }
static void ObjLoadMenu() { string pth = EditorUtility.OpenFilePanel("Import OBJ", "", "obj"); if (!string.IsNullOrEmpty(pth)) { System.Diagnostics.Stopwatch s = new System.Diagnostics.Stopwatch(); s.Start(); var loader = new OBJLoader { SplitMode = SplitMode.Object, }; loader.Load(pth); //Debug.Log($"OBJ import time: {s.ElapsedMilliseconds}ms"); s.Stop(); } }