Nanashi-soft○プログラマ専用○Unityでゲーム開発○
//ゲームオブジェクト生成
GameObject gobj = new GameObject();
gobj.name = "chara1";
//l2dcharaコンポーネントクラスを追加
gobj.AddComponent("l2dchara");
//追加したクラスを取得
l2dchara l2dcha = gobj.GetComponent("l2dchara") as l2dchara;
//リソース上の kayoko.mocファイルと,texture_00テクスチャーをロード
l2dcha.mocFile = Resources.Load("kayoko.moc") as TextAsset;
l2dcha.texture = new Texture2D[1]; //変数が配列だったので
l2dcha.texture[0] = Resources.Load("texture_00") as Texture2D;
l2dcha.texture = new Texture2D[3];
l2dcha.texture[0] = Resources.Load("texture_00") as Texture2D;
l2dcha.texture[1] = Resources.Load("texture_01") as Texture2D;
l2dcha.texture[2] = Resources.Load("texture_02") as Texture2D;