# How can i scale a cube on one side on x only?

I have in the Hierarchy a empty GameObject and a cube as child of it. The cube the child is at position 0,0,0 and scale 1,1,1

But when running the game the scaling is on both sides of the cube. I put the cube as child of the empty gameobject and scaling the empty gameobject but still it's scaling the cube on both sides.

The script is attached to the empty GameObject:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Walls : MonoBehaviour
{
Vector3 originalScale;
Vector3 destinationScale;

void Start()
{
originalScale = transform.localScale;
destinationScale = new Vector3(100.0f, 0, 0);
}

private void Update()
{
if (transform.localScale.x != 100.0f)
transform.localScale += new Vector3(1, 0, 0);
}
}


This is a working solution:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Walls : MonoBehaviour
{
public Transform[] objectstoScale;

private void Update()
{
if (objectstoScale[0].localScale.x != 100.0f)
{
objectstoScale[0].localScale += new Vector3(1, 0, 0);
}
}
}


But i want to make that the same cube will also scale one side on the z. So the cube will be scaled on both x and z but without filling it one be like frames. So i tried this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Walls : MonoBehaviour
{
public Transform[] objectstoScale;

private void Update()
{
if (objectstoScale[0].localScale.x != 100.0f)
{
objectstoScale[0].localScale += new Vector3(1, 0, 0);
objectstoScale[1].localScale += new Vector3(0, 0, 1);
}
}
}


And i have now two cubes childs of the empty gameobject one cube position is 0.5,0,0 the second is 0,0,0.5 but what i'm getting is:

What i want to do is to create automatic a rectangle scaling a cube on 4 sides at the same time not filled rectangle.

For example like this: