예제 #1
0
    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);
    }
예제 #2
0
    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));
        });
    }
예제 #3
0
 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);
     }
 }
예제 #4
0
    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));
        }
    }
예제 #5
0
 public void getImageURL2()
 {
     ImageURL2 = OpenFileName.ShowDialog();
     nowGameObjectFileControl.LoadImage(ImageURL2);
 }
예제 #6
0
 public void OnClickLoadRoom()
 {
     loadURL = OpenFileName.ShowDialog();
 }
예제 #7
0
 public void LoadImageDialog()
 {
     StartCoroutine(GetTexture(OpenFileName.ShowDialog()));
 }
 public string SelectFile()
 {
     path = OpenFileName.ShowDialog();
     Debug.Log(path);
     return(path);
 }