prefab にして処理した方が楽そうだ。
this.frame = this.ab.LoadAsset("frame.prefab") as GameObject;
this.frame = UnityEngine.Object.Instantiate<GameObject>(this.frame);
UnityEngine.Object.Destroy(this.frame);
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshFilter>().sharedMesh = this.frame.GetComponentInChildren<MeshFilter>().sharedMesh;
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshRenderer>().sharedMaterials = this.frame.GetComponent<MeshRenderer>().sharedMaterials;
オブジェクトの新規追加
this.ext = this.ab.LoadAsset("ext.prefab") as GameObject;
this.ext = UnityEngine.Object.Instantiate<GameObject>(this.ext);
this.ext.transform.SetParent(GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform);
this.ext.transform.localPosition = new Vector3(0f, 0f, 0f);
this.ext.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
this.ext.transform.localScale = new Vector3(1f, 1f, 1f);
コリジョンの置換
this.col = this.ab.LoadAsset("col.fbx") as GameObject;
this.col = UnityEngine.Object.Instantiate<GameObject>(this.col);
UnityEngine.Object.Destroy(this.col);
GameObject.Find("JONNEZ ES(Clone)/Colliders/Coll").GetComponent<MeshCollider>().sharedMesh = this.col.GetComponentInChildren<MeshFilter>().mesh;
タイヤのコリジョンの設定
public override void OnLoad()
{
//タイヤの位置設定
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelFL").transform.localPosition = new Vector3(-0.02f, 0f, 0.4698f);
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelFR").transform.localPosition = new Vector3(0.02f, 0f, 0.4698f);
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelRL").transform.localPosition = new Vector3(-0.02f, 0f, -0.47435f);
GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelRR").transform.localPosition = new Vector3(0.02f, 0f, -0.47435f);
}
public override void Update()
{
//タイヤのコリジョン設定
JONNEZ = GameObject.Find("JONNEZ ES(Clone)");
JONNEZ.GetComponent<Axles>().frontAxle.leftWheel.radius = 0.21f;
JONNEZ.GetComponent<Axles>().frontAxle.rightWheel.radius = 0.21f;
JONNEZ.GetComponent<Axles>().rearAxle.leftWheel.radius = 0.21f;
JONNEZ.GetComponent<Axles>().rearAxle.rightWheel.radius = 0.21f;
}