1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Unityメモ ゲームオブジェクトの複製

Posted at

弾丸とか敵キャラとか、プレハブ化して
複製しなきゃいけなくなるときがきました

hoge.cs
using UnityEngine;

public class hoge : MonoBehaviour {
		
	// 複製するゲームオブジェクトを登録しとく
	public GameObject obj;
		
	void Start () {
		Instantiate(obj, transform.position, Quaternion.identity);
    // 引数 は (複製するゲームオブジェクト, 複製する場所, 向き)

/*
Object Instantiate(Object original, Vector3 position, Quaterinon rotation);

Quaternion.Identity (回転してない状態)
transform.position (現在地) 
*/

	}
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?