- Home /
Question by
Pranay · May 22, 2015 at 02:36 PM ·
gameobjectinstantiatepositionunity 2d
Adjacent Placement of Objects according to varying height
Hello,
I need to place a stack of boxes on top of each other based on the height of the previous box.
The boxes vary in height.
foreach( cBox box in currentLevel.mMiddleRack.BoxWeightList)
{
box.mBoxImage = (GameObject) Instantiate(boxTemplate);
box.setBoxPosition(firstBoxPostion.x, firstBoxPostion.y, firstBoxPostion.z);
firstBoxPostion.y += box.mBoxImage.transform.localScale.y;
firstBoxPostion.z -= 1.0f;
box.shapeBox();
}
The Result:
Please Guide me!
Thanks
screen1.png
(93.2 kB)
Comment