# create primitive cube a runtime with specific size

This seems like a straight forward question that should be answered but I can’t seem to find one example of how to create a primitive transform at runtime with a specific size. For example, I would like to create a transform with the size of 1.25,1.50,1.00.

Thanks!

var cube : GameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.position = Vector3(0, 0.5, 0);
cube.transform.localScale = Vector3 (1.25, 1.5, 1);

GameObject CreatePrimitives(int totalGOs,Vector3 customScale,PrimitiveType pType){
int i =0;
GameObject setOf_GO = new GameObject[totalGOs];
while(i<totalGOs){
setOf_GO = GameObject.CreatePrimitive(pType);
setOf_GO*.transform.localScale = customScale;
_
i++;_
_
}_
return setOf_GO;
_
}*_

codeguyross1

this should work:
(call it by `createPlane(1.25, 1.50, 1.00);`)

``````void createPlane(float Scale_x, float Scale_y, float Scale_z) {

//setup a Vector3 to hold the scale variables
Vector3 scale = new Vector3(Scale_x, Scale_y, Scale_z);
//create and instantiate the plane object
GameObject pl = GameObject.CreatePrimitive(PrimitiveType.Plane);
//apply the scale variables previously saved in the Vector3
pl.transform.localScale = scale;
}
``````

of course you can also choose any other Primitive object like

``````GameObject pl = GameObject.CreatePrimitive(PrimitiveType.Cube);
``````