How can i instantiate a prefab without attach him to script ( Please i didn't found any solutions at forum )

I have a script made by a GameObject like this:

public BallStorage ballStorage;
ballStorage = new BallStorage ();

and in the script BallStorage i need to instantiate a prefab like this:

GameObject Prefab = Instantiate (prefab, new Vector3 (x, y, z), transform.rotation) as GameObject;

but i can’t do this because a didn’t have a prefab attached to the script, because the script isn’t attached to any gameobject…

please, someone helpme!!!

Have the script attached to the GameObject that you wish to instantiate the ball. Then assign the ball prefab via the inspector on the GameObject that is to Instantiate the ball. If you do not wish to assign the prefab this way, you can try using something like Resources.Load and keep the variable private.