Instantiate GameObject

Hey, i’m new to unity and i have a question. I have this prefab in my project and i want to instantiate it but without have to drag n drop it on my script:

GameObject MyObject = new GameObject(“MyPrefabName”);

This way i will just create a empty GO (not the prefab in my project)

public GameObject MyObject;
Drag n Drop my prefab on the Inspector

GameObject MyInstance = (GameObject)Instantiate(MyObject);

This do it right but i want to type my prefab name(or something like this) instead of drag n drop it.

How can i do that?

Thanks. Sorry about my english.

there are two ways that i can think of.

one you can set a variable like this:

var Prefab : Transform;

then you execute the Instantiate on that var.

or you can put the prefab in the resources folder in your assets and call it via Recources.Load function.

Thanks, this will do.