How does one store a prefab as a template not an instance?

Ok I am beginning work on an inventory system that will allow players to pick up and place blocks and other items. Since each object in the inventory will represent an in game object I would like to reference the prefab that is cloned when the object is in game.

For example: The player has five bricks. The inventory slot might be an array where the first Slot[0] holds the number of objects in that inventory slot (Slot[0] = 5), and Slot[1] holds the prefab that should be spawned when the block is placed (Slot[1] = BrickPrefab).

Basically I am trying to store the template from which to spawn an item, not an actual in game item which would be an instance. Is this possible? If so how?

Very possible, just do the following:

  1. create an empty scene

  2. add a gameObject & attach the prefab factory to it

    using UnityEngine;
    using System.Collections;

    public class PrefabFactory : MonoBehaviour
    {
    public Transform PrefabTemplates;
    }

    public GameObject Create(int Id, Vector3 OurPosition, Quaternion OurOrientation)
    {
    return Instantiate(PrefabTemplates[Id], OurPosition, OurOrientation) as Transform).gameObject;
    }

  3. drag your prefab(s) from the project window into the prefabTemplates array

  4. Call PrefabFactory.Instantiate(Id, Position, Orientation);

Ok got it figured out. Thanks to Weenchehawk, from your code I figured out that “Transform” is the type of variable that can store a prefab as a template instead of storing an instance. For example:

JavaScript:
var MyTemplate : Transform[];

C#
public Transform[] MyTemplate;