unity 3d student

Beginner B05 – Instantiate to Create Objects

How to create objects in your scene during runtime using Prefabs and the Instantiate() command.

Code Used

//Simple Instantiation of a Prefab at Start
  1. var thePrefab : GameObject;
  2.  
  3. function Start () {
  4.  var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation);
  5. }

Further Reading

Share via Social Media

  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Add to favorites

39 Comments