How can i instantiate as a child, and also simplify?

Here is my (horribly awful) code so far

if (delay < 0) {
			Rigidbody ZInstance = Instantiate(Prefab, SpawnPos, transform.rotation) as Rigidbody;
			delay = origDelay;
		}

How can simplify this code, and how can i spawn said instances as a child to an empty object placed in the scene? thanks!

Prefab is a GameObject, so use:

GameObject instance = Instantiate( prefab, position, rotation ) as GameObject;
Rigidbody ZInstance = instance.GetComponent<Rigidbody>();

instance.transform.SetParent( myObjectInTheScene.transform );

if you are trying to “spawn” a rigid body to an object you whould simply say:

gameObject.AddComponent ("Rigidbody");

im not sure exactly what you want to do. if you want to spawn an object you would do it like this:

var newguy:GameObject;

newguy= Instantiate(Prefab, SpawnPos, transform.rotation);
newguy.transform.parent=someothergameobject.transform;

newguy.rigidbody.changewhatever=??????

[SerializeField]
private GameObject parentObject;

GameObject instance = Instantiate( prefab, position, rotation ) as GameObject;
parentObject.transform.parent = instance.transform;