Beispiel #1
0
        private void OnLoaded(VRMImporterContext context)
        {
            //読込が完了するとcontext.RootにモデルのGameObjectが入っています
            var root = context.Root;

            //モデルをワールド上に配置します
            root.transform.SetParent(PlayerObject.transform, false);

            //    HeadTarget.transform.Reset(true);
            //    RightHandTarget.transform.Reset(true);
            //       LeftHandTarget.transform.Reset(true);
            //
            HeadTarget.transform.localPosition = new Vector3(0, 0, -0.16f);

            //var rightoffsetPosition =  rightcontroller.transform.InverseTransformPoint(RightModel.transform.position);
            ////var rightoffsetrotation = rightcontroller.transform.InverseTransformDirection(RightModel.transform.rotation);
            //var leftoffsetPosition = leftcontroller.transform.InverseTransformPoint(LeftModel.transform.position);
            ////var leftoffsetrotation = Quaternion.Inverse(LeftHandTarget.transform.localRotation) ;
            //;
            //RightWP1.transform.localPosition = rightoffsetPosition;
            //RightWP2.transform.localPosition = rightoffsetPosition;
            //LeftWP1.transform.localPosition = leftoffsetPosition;
            //LeftWP2.transform.localPosition = leftoffsetPosition;
            //RightWP1.transform.LookAt(RightModel.transform.forward);
            //RightWP2.transform.LookAt(RightModel.transform.forward);
            //LeftWP1.transform. LookAt(LeftModel.transform.forward);
            //LeftWP2.transform.LookAt(LeftModel.transform.forward);


            RightHandTarget.transform.localPosition = new Vector3(0.03f, 0.025f, -0.12f);
            LeftHandTarget.transform.localPosition  = new Vector3(-0.03f, 0.025f, -0.12f);
            //HeadTarget.transform.localRotation = new Quaternion(-0.3535534f,0.1464466f,-0.3535534f,0.8535535f);
            RightHandTarget.transform.localRotation = new Quaternion(-0.2418447f, -0.2418447f, -0.664463f, 0.664463f);
            //RightWP1.transform.localRotation = new Quaternion(0.2418447f, 0.2418447f, 0.664463f, -0.664463f);
            //RightWP2.transform.localRotation = new Quaternion(0.2418447f, 0.2418447f, 0.664463f, -0.664463f);

            LeftHandTarget.transform.localRotation = new Quaternion(-0.2418447f, 0.2418447f, 0.664463f, 0.664463f);
            //LeftWP1.transform.localRotation = new Quaternion(0.2418447f, -0.2418447f,-0.664463f,-0.664463f);
            //LeftWP2.transform.localRotation = new Quaternion(0.2418447f, -0.2418447f,-0.664463f,-0.664463f);
            SetupVRIK(root, HeadTarget, LeftHandTarget, RightHandTarget);
            AnimatorVariabler(root);
            NowAvatar.SetActive(false);
            Destroy(NowAvatar);
            //メッシュを表示します
            context.ShowMeshes();
            root.transform.localPosition = new Vector3(0, 0, 0);
            root.transform.localRotation = Quaternion.identity;
            NowAvatar = root;
        }
Beispiel #2
0
    /// <summary>
    /// Unload the old model and load the new model from VRM file.
    /// </summary>
    /// <param name="path"></param>
    private void LoadModel(string path)
    {
        if (!File.Exists(path))
        {
            return;
        }
        GameObject newModelObject = null;

        try
        {
            // Load from a VRM file.
            context = new VRMImporterContext();
            //Debug.Log("Loading model : " + path);

            context.Load(path);
            newModelObject = context.Root;
            meta           = context.ReadMeta();

            context.ShowMeshes();
        }
        catch (Exception ex)
        {
            if (uiController)
            {
                uiController.SetWarning("Model load failed.");
            }
            Debug.LogError("Failed loading " + path);
            Debug.LogError(ex);
            return;
        }

        if (newModelObject)
        {
            if (model)
            {
                GameObject.Destroy(model.gameObject);
            }

            model = newModelObject.AddComponent <HumanPoseTransfer>();
            SetMotion(motion, model, meta);

            model.gameObject.AddComponent <CharacterBehaviour>();

            if (uiController)
            {
                uiController.Show(meta);
            }
        }
    }
Beispiel #3
0
        /// <summary>
        /// Byte配列からVRMImporterContextの初期化をします
        /// </summary>
        /// <param name="vrmByteArray"></param>
        public void InitializeVrmContextFromByteArray(byte[] vrmByteArray)
        {
#if UNIVRM_LEGACY_IMPORTER
            // VRMImporterContextがVRMを読み込む機能を提供します
            currentContext = new VRMImporterContext();

            // GLB形式でJSONを取得しParseします
            currentContext.ParseGlb(vrmByteArray);
#elif UNIVRM_0_68_IMPORTER
            var parser = new GltfParser();
            parser.ParseGlb(vrmByteArray);
            currentContext = new VRMImporterContext(parser);
#else
#endif
        }
    void VRM(string path)
    {
        var bytes   = File.ReadAllBytes(path);
        var context = new VRMImporterContext();

        context.ParseGlb(bytes);

        var meta  = context.ReadMeta(true);
        var modal = Instantiate(LoadConfirmModal, Canvas.transform) as GameObject;
        var ui    = modal.GetComponentInChildren <VRMPreviewUI>();

        ui.setMeta(meta);
        ui.setLoadable(true);
        ui.m_ok.onClick.AddListener(() => LoadAsync(context, path));
    }
        private void ModelLoad(VRMImporterContext context)
        {
            var now = Time.time;

            context.LoadAsync(_ =>
            {
                context.ShowMeshes();
                var go = context.Root;
                // load完了
                var delta = Time.time - now;
                Debug.LogFormat("LoadVrmAsync {0:0.0} seconds", delta);
                OnLoaded(go);
            },
                              Debug.LogError);
        }
Beispiel #6
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));
        }
    }
Beispiel #7
0
        /// <summary>
        /// 非同期でByte配列からVRMImporterContextの初期化をします
        /// </summary>
        /// <param name="vrmByteArray"></param>
        public async Task InitializeVrmContextFromByteArrayAsync(byte[] vrmByteArray)
        {
#if UNIVRM_LEGACY_IMPORTER
            // VRMImporterContextがVRMを読み込む機能を提供します
            currentContext = new VRMImporterContext();

            // GLB形式でJSONを取得しParseします
            await Task.Run(() => currentContext.ParseGlb(vrmByteArray));
#elif UNIVRM_0_68_IMPORTER
            var parser = new GltfParser();
            await Task.Run(() => parser.ParseGlb(vrmByteArray));

            currentContext = new VRMImporterContext(parser);
#else
#endif
        }
Beispiel #8
0
        IEnumerator Loading(Camera mainCamera, int defaultCullingMask, VrmMeta vrmMeta)
        {
            //Loading表示に切り替えるために1フレーム待つ
            yield return(null);

            var bytes = File.ReadAllBytes(GlobalPath.VrmHomePath + "/" + vrmMeta.VrmFileName);
            var vrmImporterContext = new VRMImporterContext();

            vrmImporterContext.ParseGlb(bytes);
            vrmImporterContext.Load();
            vrmImporterContext.Root.transform.SetParent(vrmRoot, false);
            vrmImporterContext.EnableUpdateWhenOffscreen();
            vrmImporterContext.ShowMeshes();
            poolingVrmImporterContexts.Add(new KeyValuePair <string, VRMImporterContext>(vrmMeta.VrmFileName, vrmImporterContext));
            mainCamera.cullingMask = defaultCullingMask;
        }
Beispiel #9
0
    void LoadFromFile()
    {
        //VRMファイルのパスを指定します
        var path = Application.dataPath + "/Resources/vj_takagi.vrm";

        //ファイルをByte配列に読み込みます
        var bytes = System.IO.File.ReadAllBytes(path);

        var context = new VRMImporterContext();

        // GLB形式でJSONを取得しParseします
        context.ParseGlb(bytes);

        context.Load();
        OnLoaded(context);
    }
Beispiel #10
0
        /// <summary>
        /// upload VRM file to server
        /// </summary>
        /// <param name="filepath">Current VRM model path</param>
        public async Task UploadVRM(string filepath)
        {
            var fileType             = new MetadataChange();
            StorageReference vrmPath = Storage_ref.Child("VRP/" + CurrentUser.UserId + "/vrm/" + Path.GetFileName(filepath));
            //get thumbnail form vrm
            var context = new VRMImporterContext();

            byte[] vrmByte = null;
            using (FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read))
            {
                vrmByte = new byte[fs.Length];
                fs.Read(vrmByte, 0, vrmByte.Length);
                context.ParseGlb(vrmByte);
            }
            var meta = context.ReadMeta(true);

            string th;

            byte[] thumbnailData = meta.Thumbnail.EncodeToPNG();
            try
            {
                th = Convert.ToBase64String(thumbnailData);
            }
            catch (Exception e)
            {
                th = "";
            }
            isUploading          = true;
            fileType.ContentType = "application/vrm";

            await vrmPath.PutBytesAsync(vrmByte, fileType).ContinueWith((Task <StorageMetadata> task) =>
            {
                if (task.IsFaulted || task.IsCanceled)
                {
                    Debug.Log(task.Exception.ToString());
                    // Uh-oh, an error occurred!
                    isUploading = false;
                }
                else
                {
                    // Metadata contains file metadata such as size, content-type, and download URL.
                    metadata = task.Result;
                    Debug.Log("Finished uploading...");
                }
                isUploading = false;
            });
        }
Beispiel #11
0
    public async Task <Transform> LoadVRM()
    {
        var bytes   = File.ReadAllBytes(vrmPath);
        var context = new VRMImporterContext();

        context.ParseGlb(bytes);

        var metadata = context.ReadMeta(false);

        Debug.LogFormat("meta: title: {0}", metadata.Title);

        await context.LoadAsyncTask();

        context.ShowMeshes();

        return(context.Root.transform);
    }
Beispiel #12
0
    private async void ImportVRM(string path, bool ImportForCalibration)
    {
        CurrentSettings.VRMPath = path;
        var context = new VRMImporterContext(path);

        var bytes = File.ReadAllBytes(path);

        // GLB形式でJSONを取得しParseします
        context.ParseVrm(bytes);

        if (CurrentModel != null)
        {
            CurrentModel.transform.SetParent(null);
            CurrentModel.SetActive(false);
            Destroy(CurrentModel);
            CurrentModel = null;
        }
        // ParseしたJSONをシーンオブジェクトに変換していく
        CurrentModel = await VRMImporter.LoadVrmAsync(context);

        //LipSync
        LipSync.ImportVRMmodel(CurrentModel);
        //まばたき
        blinkController.ImportVRMmodel(CurrentModel);

        CurrentModel.transform.SetParent(transform, false);

        SetVRIK(CurrentModel);
        if (ImportForCalibration == false)
        {
            SetCameraLookTarget();
            //SetTrackersToVRIK();
        }
        else
        {
            var animator = CurrentModel.GetComponent<Animator>();
            if (animator != null)
            {
                if (CalibrationCamera != null)
                {
                    CalibrationCamera.Target = animator.GetBoneTransform(HumanBodyBones.Head);
                    CalibrationCamera.gameObject.SetActive(true);
                }
            }
        }
    }
Beispiel #13
0
    void Start()
    {
        System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();

        stopwatch.Start();
        const string path  = "AliciaSolid_1.10.vrm";
        var          bytes = File.ReadAllBytes(path);

        stopwatch.Stop();
        Debug.Log("ReadAllBytes: " + (float)stopwatch.Elapsed.TotalSeconds + " sec");

        stopwatch.Restart();
        using (var metaLoader = new MetaLoader(bytes))
        {
            var meta = metaLoader.Read();
            stopwatch.Stop();
            Debug.Log("QuickMetaLoader: " + (float)stopwatch.Elapsed.TotalSeconds + " sec");

            ViewMeta(meta);
            LoadIcon(metaLoader);
        }

        stopwatch.Restart();
        using (var jobMetaLoader = new JobMetaLoader(path))
        {
            var meta = jobMetaLoader.Read();
            stopwatch.Stop();
            Debug.Log("JobMetaLoader: " + (float)stopwatch.Elapsed.TotalSeconds + " sec");

            ViewMeta(meta);
            LoadIconJob(jobMetaLoader, meta);
        }
        stopwatch.Stop();

        stopwatch.Restart();
        var context = new VRMImporterContext();

        context.ParseGlb(bytes);
        stopwatch.Stop();
        Debug.Log("VRM ParseGlb: " + (float)stopwatch.Elapsed.TotalSeconds + " sec");

        stopwatch.Restart();
        context.ReadMeta(true);
        stopwatch.Stop();
        Debug.Log("VRM ReadMeta: " + (float)stopwatch.Elapsed.TotalSeconds + " sec");
    }
Beispiel #14
0
    private void OnLoaded(VRMImporterContext context)
    {
        GameObject[] othreAvatars = GameObject.FindGameObjectsWithTag("Avatar");
        foreach (GameObject otherAvatar in othreAvatars)
        {
            Destroy(otherAvatar);
        }

        Avatar = context.Root;

        Avatar.transform.SetParent(transform, false);
        Avatar.gameObject.tag = "Avatar";

        context.ShowMeshes();

        AvatarLoaded();
    }
    /// <summary>
    /// vrm読み込み確認
    /// </summary>
    public void Load(string path)
    {
        var bytes = File.ReadAllBytes(path);

        Context = new VRMImporterContext();
        Context.ParseGlb(bytes);

        // VRMLoaderUI
        var modalObject = Instantiate(m_modalWindowPrefab, m_canvas.transform) as GameObject;
        var modalUI     = modalObject.GetComponentInChildren <VRMPreviewUI>();

        modalUI.setMeta(Context.ReadMeta(true));
        modalUI.setLoadable(true);
        modalUI.m_ok.onClick.AddListener(Load);

        Path = path;
    }
Beispiel #16
0
        public void MeshCopyTest()
        {
            var path    = AliciaPath;
            var context = new VRMImporterContext();

            context.ParseGlb(File.ReadAllBytes(path));
            context.Load();
            context.ShowMeshes();
            context.EnableUpdateWhenOffscreen();

            foreach (var mesh in context.Meshes)
            {
                var src = mesh.Mesh;
                var dst = src.Copy(true);
                MeshTests.MeshEquals(src, dst);
            }
        }
Beispiel #17
0
    /// <summary>
    /// Unload the old model and load the new model from VRM file.
    /// </summary>
    /// <param name="path"></param>
    private void LoadModel(string path)
    {
        if (!File.Exists(path))
        {
            return;
        }

        GameObject newModel = null;

        try
        {
            // Load from a VRM file.
            byte[] bytes = File.ReadAllBytes(path);
            context = new VRMImporterContext(UniGLTF.UnityPath.FromFullpath(path));
            context.ParseGlb(bytes);
            VRMImporter.LoadFromBytes(context);

            newModel = context.Root;
            meta     = context.ReadMeta();
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
            return;
        }

        if (model)
        {
            GameObject.Destroy(model.gameObject);
        }

        if (newModel)
        {
            model = newModel.AddComponent <HumanPoseTransfer>();
            SetMotion(motion, model, meta);

            model.gameObject.AddComponent <CharacterBehaviour>();


            if (uiController)
            {
                uiController.Show(meta);
            }
        }
    }
        public void Show(VRMImporterContext context)
        {
            CreateCanvasIfNotExist();

            var meta = context.ReadMeta(true);

            _otherPermissionUrl = meta.OtherPermissionUrl ?? "";
            _otherLicenseUrl    = meta.OtherLicenseUrl ?? "";
            _canvas.UISupport.ButtonOpenOtherPermissionUrl.interactable = !string.IsNullOrEmpty(_otherPermissionUrl);
            _canvas.UISupport.ButtonOpenOtherLicenseUrl.interactable    = !string.IsNullOrEmpty(_otherLicenseUrl);

            //サムネが無いVRMをロードするとき、前回のサムネが残っちゃうのを防ぐ
            _canvas.UISupport.ResetThumbnail();

            _canvas.Locale.SetLocale(LanguageNameToLocaleName(_previewLanguage.Language));
            _canvas.PreviewUI.setMeta(meta);
            _canvas.gameObject.SetActive(true);
        }
Beispiel #19
0
        public void MeshCopyTest()
        {
            var path = AliciaPath;
            var data = new GlbFileParser(path).Parse();

            using (var context = new VRMImporterContext(new VRMData(data)))
                using (var loaded = context.Load())
                {
                    loaded.ShowMeshes();
                    loaded.EnableUpdateWhenOffscreen();
                    foreach (var mesh in context.Meshes)
                    {
                        var src = mesh.Mesh;
                        var dst = src.Copy(true);
                        MeshTests.MeshEquals(src, dst);
                    }
                }
        }
Beispiel #20
0
        private static GameObject ImportVRM(string path, string playername)
        {
            var bytes   = File.ReadAllBytes(path);
            var context = new VRMImporterContext();

            context.ParseGlb(bytes);

            try
            {
                context.Load();
            }
            catch { }

            // モデルスケール調整
            context.Root.transform.localScale *= Settings.ReadFloat(playername, "ModelScale", 1.0f);

            return(context.Root);
        }
Beispiel #21
0
    async void ShowAvatarInfo()
    {
        VRMMetaObject meta;

        try
        {
            // Load and analyze VRM
            var ctx = new VRMImporterContext();
            ctx.ParseGlb(File.ReadAllBytes(AvatarInput.text));
            meta = ctx.ReadMeta();
            ctx.Dispose();

            // Create information text
            using (var writer = new StringWriter())
            {
                writer.NewLine = "\n";
                writer.WriteLine($"<b>{meta.Title}</b> by <b>{meta.Author} ({meta.ContactInformation})</b>");

                // Use Unity's text styling to emphasize some information
                // (coloring is done in ColorizeVrmAllowedUser and ColorizeVrmUsageLicense methods)
                //  https://docs.unity3d.com/ja/2019.4/Manual/StyledText.html
                writer.WriteLine($"Allowed user: <b>{ColorizeVrmAllowedUser(meta.AllowedUser)}</b>");
                writer.WriteLine($"Violent usage: <b>{ColorizeVrmUsageLicense(meta.ViolentUssage)}</b>");
                writer.WriteLine($"Sexual usage: <b>{ColorizeVrmUsageLicense(meta.SexualUssage)}</b>");
                writer.WriteLine($"Commercial usage: <b>{ColorizeVrmUsageLicense(meta.CommercialUssage)}</b>");
                writer.WriteLine($"Other permission: <b>{meta.OtherPermissionUrl}</b>");
                writer.WriteLine($"License: <b>{meta.LicenseType}</b>");
                writer.WriteLine($"Other license: <b>{meta.OtherLicenseUrl}</b>");

                AvatarInfo.text = writer.ToString();
            }
        }
        catch (Exception e)
        {
            AvatarInfo.text = "<color=red>Avatar load error</color>\n" + e.ToString();
        }

        // Rebuild Vertical Layout Group using new size of AvatarInfo (changed according to its content by Content Size Filter)
        //  https://docs.unity3d.com/ja/2019.4/Manual/UIAutoLayout.html
        //  https://docs.unity3d.com/ja/2019.4/Manual/HOWTO-UIFitContentSize.html
        await UniTask.WaitForEndOfFrame();  // Somehow, frame wait is needed before MarkLayoutForRebuild

        LayoutRebuilder.MarkLayoutForRebuild(AvatarInfo.transform.parent.GetComponent <RectTransform>());
    }
Beispiel #22
0
        void LoadModel(string path)
        {
            if (!File.Exists(path))
            {
                return;
            }

            Debug.LogFormat("{0}", path);
            var ext = Path.GetExtension(path).ToLower();

            switch (ext)
            {
            case ".vrm":
            {
                var context = new VRMImporterContext();
                var file    = File.ReadAllBytes(path);
                context.ParseGlb(file);
                m_texts.UpdateMeta(context);
                context.Load();
                context.ShowMeshes();
                context.EnableUpdateWhenOffscreen();
                context.ShowMeshes();
                SetModel(context.Root);
                break;
            }

            case ".glb":
            {
                var context = new UniGLTF.ImporterContext();
                var file    = File.ReadAllBytes(path);
                context.ParseGlb(file);
                context.Load();
                context.ShowMeshes();
                context.EnableUpdateWhenOffscreen();
                context.ShowMeshes();
                SetModel(context.Root);
                break;
            }

            default:
                Debug.LogWarningFormat("unknown file type: {0}", path);
                break;
            }
        }
Beispiel #23
0
        void OnLoaded(VRMImporterContext context)
        {
            if (_model != null)
            {
                GameObject.Destroy(_model.gameObject);
            }

            _model = context.Root;
            _model.transform.position = new Vector3(-10, 0, 0);
            _model.transform.rotation = Quaternion.Euler(0, 270, 0);

            context.ShowMeshes();
            context.EnableUpdateWhenOffscreen();

            // VR化用に追記
            _model.AddComponent <VRIK>();
            _model.GetComponent <VRIK>().solver.spine.headTarget = GameObject.Find("Head_Target").transform;
            _model.GetComponent <VRIK>().solver.leftArm.target   = GameObject.Find("Hand_L_Target").transform;
            _model.GetComponent <VRIK>().solver.rightArm.target  = GameObject.Find("Hand_R_Target").transform;

            // akiraさんのQiitaよりがに股を直すように設定
            _model.GetComponent <VRIK>().solver.leftLeg.swivelOffset     = 15f;
            _model.GetComponent <VRIK>().solver.rightLeg.swivelOffset    = -15f;
            _model.GetComponent <VRIK>().solver.locomotion.footDistance  = 0.4f;
            _model.GetComponent <VRIK>().solver.locomotion.stepThreshold = 0.3f;
            _model.GetComponent <VRIK>().solver.locomotion.maxVelocity   = 0.3f;
            _model.GetComponent <VRIK>().solver.locomotion.rootSpeed     = 30f;
            _model.GetComponent <VRIK>().solver.plantFeet = false;

            //自分のカメラに頭が映らないように VRMFirstPerson の設定
            _model.GetComponent <VRM.VRMFirstPerson>().Setup();
            foreach (var renderer in GetComponentsInChildren <SkinnedMeshRenderer>(true))
            {
                renderer.updateWhenOffscreen = true;
            }

            // リップシンクのターゲット指定
            var aniLipSync = GameObject.Find("AniLipSync-VRM");

            aniLipSync.GetComponent <AnimMorphTarget>().blendShapeProxy = _model.GetComponent <VRMBlendShapeProxy>();

            // まばたきをする設定
            _model.AddComponent <VRM.Blinker>();
        }
Beispiel #24
0
        public static async UniTask <GameObject> LoadVRMAsync(byte[] bytes)
        {
            var context = new VRMImporterContext();

            try
            {
                context.ParseGlb(bytes);
                var meta = context.ReadMeta(false);
                await context.LoadAsyncTask();

                context.ShowMeshes();
                return(context.Root);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                throw;
            }
        }
        private async UniTask LoadJson(string url)
        {
            byte[]        data;
            VRMMetaObject meta;

            using (var uwr = UnityWebRequest.Get(url))
            {
                await uwr.SendWebRequest();

                data = uwr.downloadHandler.data;
            }
            using (var context = new VRMImporterContext())
            {
                context.ParseGlb(VRMdata);
                meta = context.ReadMeta(true);
            }

            SetVRMmeta(meta);
        }
Beispiel #26
0
        //モデルを読み込む
        private void LoadVRM(string path)
        {
            //存在すれば即破壊(異常顔防止)
            if (Model != null)
            {
                Destroy(Model);
                Model = null;
            }
            if (LoadedModelParent != null)
            {
                Destroy(LoadedModelParent);
                LoadedModelParent = null;
            }

            //バイナリの読み込み
            if (File.Exists(path))
            {
                byte[] VRMdata = File.ReadAllBytes(path);
                //読み込み
                VRMImporterContext vrmImporter = new VRMImporterContext();
                vrmImporter.ParseGlb(VRMdata);

                vrmImporter.LoadAsync(() =>
                {
                    Model = vrmImporter.Root;

                    //ExternalReceiverの下にぶら下げる
                    LoadedModelParent = new GameObject();
                    LoadedModelParent.transform.SetParent(transform, false);
                    LoadedModelParent.name = "LoadedModelParent";
                    //その下にモデルをぶら下げる
                    Model.transform.SetParent(LoadedModelParent.transform, false);

                    vrmImporter.EnableUpdateWhenOffscreen();
                    vrmImporter.ShowMeshes();
                });
            }
            else
            {
                Debug.LogError("VRM load failed.");
            }
        }
        async UniTask LoadVRM(string path)
        {
#if UNITY_WEBGL
            VRMMetaObject meta;
            using (UnityWebRequest uwr = UnityWebRequest.Get(path))
            {
                await uwr.SendWebRequest();

                VRMdata = uwr.downloadHandler.data;
            }
            using (var context = new VRMImporterContext())
            {
                context.ParseGlb(VRMdata);
                meta = context.ReadMeta(true);
            }
#else
            var meta = await VRMMetaImporter.ImportVRMMeta(path, true);
#endif
            SetVRMmeta(meta);
        }