I need an explanation for "Instantiating Prefabs at runtime"

First of all. I got it to work. I spent a good hour and half on it, but my first trip-up in this example was getting it run. No matter how many times I’ve played it, I wouldn’t see any cubes falling down. Here’s the script I’m using:

using UnityEngine;
using System.Collections;

public class Instantiation : MonoBehaviour {

    // Use this for initialization
    public Transform brick;
   
    void Start() {
        for (int y = 0; y < 5; y++) {
            for (int x = 0; x < 5; x++) {
                Instantiate(brick, new Vector3(x, y, 0), Quaternion.identity);
            }
        }
    }
   
    // Update is called once per frame
    void Update () {
   
    }
}

And here’s the instructions I’m following on creating the “Brick” prefab and adding a reference to the script’s brick variable.

Now let me show you what happens when I press play.

Again, it took me an hour and a half until a light bulb switched on in my head. I dragged and dropped the script file, from the project viewer, onto the the hierarchy viewer.

Then the magic begins.

Obviously I’m new to Unity 3D since I’m following the manual and all, but I would appreciate an explanation on what I did to get it to work.

I got my answer in Answers.

I needed to attach the script to a GameObject.

http://docs.unity3d.com/Manual/TheComponent-ScriptRelationship.html