Created
January 22, 2019 13:05
-
-
Save bibinba/d092b5174ba74bfed01303100cf5d021 to your computer and use it in GitHub Desktop.
アニメーションを付けるバージョンVRM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using System; | |
using System.Windows.Forms; | |
using VRM; | |
public class vrmimport : MonoBehaviour | |
{ | |
IEnumerator LoadVrmCoroutine(string path, Action<GameObject> onLoaded) | |
{ | |
var www = new WWW(path); | |
yield return www; | |
VRMImporter.LoadVrmAsync(www.bytes, onLoaded); | |
} | |
public void onFileOpen() | |
{ | |
OpenFileDialog ofDialog = new OpenFileDialog(); | |
// デフォルトのフォルダを指定する | |
//ofDialog.InitialDirectory = @"A:"; | |
ofDialog.FileName = "A:"; | |
//csvファイルを開くことを指定する | |
ofDialog.Filter = "vrmファイル|*.vrm"; | |
//ダイアログのタイトルを指定する | |
ofDialog.Title = "VRMファイルを開け!!!!!"; | |
//ダイアログを表示する | |
if (ofDialog.ShowDialog() == DialogResult.OK) | |
{ | |
var path = ofDialog.FileName; | |
StartCoroutine(LoadVrmCoroutine(path, go =>///VRM読み込む | |
{ | |
go.transform.position = new Vector3(0, 0, 0);///位置指定 | |
var addAnimation = new AddAnimation();///Animator付ける(別スクリプト参照 | |
addAnimation.AddAnimationController(go); | |
})); | |
} | |
else | |
{ | |
Console.WriteLine("キャンセルされました"); | |
} | |
// オブジェクトを破棄する | |
ofDialog.Dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment