オブジェクトの複製

オブジェクトの複製


<参考資料>

cloneに指定したオブジェクトを10個複製するサンプル

using UnityEngine;
using System.Collections;

public class levelScript1 : MonoBehaviour {
  
   public Transform clone;
   
   // Use this for initialization
   void Start () {
       Example(clone);
   }
   
   // Update is called once per frame
   void Update () {
   }
   
   void    Example(Transform item){
       for (int i = 0; i < 10; i++) {
           Instantiate(item,item.transform.position + new Vector3(i*2.0f,0,0),Quaternion.identity);
       }
   }
}

メニュー




  • 最終更新:2014-06-13 12:08:08

このWIKIを編集するにはパスワード入力が必要です

認証パスワード