IEnumerator CignetLoad() { string path = OpenFileName.ShowDialog("all", "all"); AssetBundleCreateRequest asyncBundleRequest = AssetBundle.LoadFromFileAsync(path); yield return(asyncBundleRequest); AssetBundle localAssetBundle = asyncBundleRequest.assetBundle; if (localAssetBundle == null) { Debug.LogError("Failed to load AssetBundle!"); yield break; } AssetBundleRequest assetRequest = localAssetBundle.LoadAssetAsync <GameObject>(assetName); yield return(assetRequest); GameObject prefab = assetRequest.asset as GameObject; Instantiate(prefab); localAssetBundle.Unload(false); }
private void Start() { Avatar = null; _buttonVRM?.onClick.AddListener(async() => { var bytes = await UniTask.Run(() => ReadBytes()); if (bytes != null) { var context = new VRMImporterContext(); await UniTask.Run(() => context.ParseGlb(bytes)); var meta = context.ReadMeta(false); context.LoadAsync(() => OnLoaded(context)); } }); _buttonAssetBundle?.onClick.AddListener(async() => { string path = await Task.Run(() => OpenFileName.ShowDialog("all", ".")); //前のアバターの消去 GameObject[] othreAvatars = GameObject.FindGameObjectsWithTag("Avatar"); foreach (GameObject otherAvatar in othreAvatars) { Destroy(otherAvatar); } StartCoroutine(LoadBundleCoroutine(path)); }); }
private byte[] ReadBytes() { try{ string path = OpenFileName.ShowDialog("open vem", "vrm"); return(File.ReadAllBytes(path)); } catch (Exception e) { Debug.Log("the file could not find"); Debug.Log(e.Message); return(null); } }
private void OnGUI() { if (GUI.Button(new Rect(100, 100, 200, 40), "VRM Import")) { string path = OpenFileName.ShowDialog("open vrm", "vrm"); var bytes = File.ReadAllBytes(path); var context = new VRMImporterContext(); context.ParseGlb(bytes); var meta = context.ReadMeta(false); context.LoadAsync(_ => OnLoaded(context)); } }
public void getImageURL2() { ImageURL2 = OpenFileName.ShowDialog(); nowGameObjectFileControl.LoadImage(ImageURL2); }
public void OnClickLoadRoom() { loadURL = OpenFileName.ShowDialog(); }
public void LoadImageDialog() { StartCoroutine(GetTexture(OpenFileName.ShowDialog())); }
public string SelectFile() { path = OpenFileName.ShowDialog(); Debug.Log(path); return(path); }