how to define a variable?

how to define a variable? in this case a simple cube …

In programming, a variable is any kind of reference types or value types, so to answer your question the way the headline asks it:

int thisIsAnIntegerVariable = 5;

That’s how to declare an integer variable, for instance. :slight_smile:

But it sounds like you’d like to know how to instantiate a cube gameobject. That’s something more specific than just “defining a variable”. You can do that with a single line of code:

GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

You can then access the cube’s transform to set its scale, rotation, position, etc…