Instantiate Prefab

How do you instantiate a Prefab in C#? I've been doing it by loading a resource and then casting it into a UnityEngine.Object:

UnityEngine.Object MyPrefab = Resources.Load("MyPrefabl");

Is there a way to do it without using the Resources.Load?

Thanks!

define a public variable of type GameObject in your component (script) and then in the inspector drag a prefab on it and you can instantiate it.

public class script1 : MonoBehavior
{
public GameObject ball;
void Start ()
{
GameObject myball = (GameObject)instantiate (ball);
}
}

when you attach this small script to a gameObject it will add script1 component to it's inspector and the script1 component has a slot called ball. you should drag a prefab to it and then the code will instantiated that dragged prefab.

public GameObject obj;

void Start () {
    GameObject myPrefab = (GameObject)Instantiate(obj);
}