Creating Objects using Code

Creating Objects using Code
– This is called Instantiating
– You are creating a new instance of something

References
References allow to drag-and-drop objects into code using the Unity Editor.

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

	public GameObject objectToCreate;

	// Use this for initialization
	void Start () {
		// make an object
		Object.Instantiate(objectToCreate, new Vector3(2,4,6), Outereign.identity);
	}
	
	// Update is called once per frame
	void Update () {

	}
}