Rotating multiples objects as one


I’ve looked into this a little bit and I’m still having trouble finding something close to what I need.

I want to create a large cube made up of individual smaller cubes that act as one giant object rotating on the y axis constantly at a set speed.

The closest thing I can think of is a collection of constant base position vectors for the original instantiating of the cubes, but I can’t think of a way to get the cubes to act as one.

Any advice would be appreciated,


What you need is object parenting. If you are building the cubes in the editor, just create an empty game object, and position it at 0, 0,0. Now create your cubes and drag them under the empty game object (feel free to rename it to Parent or whatever you want). Now move these game objects wherever you want them, relative to the parent. Now you can rotate the parent game object, and the others will rotate around it.

If doing it in script at runtime, simply assign the transform.parent to the transform of a parent object. For instance, using the scenario above:

public GameObject mainCube;
public GameObject cubePrefab;

void AddChild()
    GameObject child = Instantiate(cubePrefab);
    child.transform.parent = mainCube.transform;
    child.transform.localPosition = new Vector3(0, 0, 0);


You can change the 0,0,0 vector to something else, I am just demonstrating setting the local position.