How can i change the walls height and keep the size for example 100x100 but height 0.1 ?

This is the original code:

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

public class WallsTest : MonoBehaviour
{
    // using a GameObject rather than a transform
    public GameObject prefab;
    public float wallsSize;
    public Vector3 wallsStartPosition;

    // list updated to GameObject
    private List<GameObject> walls = new List<GameObject>();

    void Start()
    {
        for (int i = -2; i < 2; i++)
        {
            // instantiate GameObjects
            GameObject go = Instantiate(prefab);
            go.transform.parent = transform;

            // defaults
            Vector3 scale = new Vector3(wallsSize, wallsSize, wallsSize);
            Vector3 adjustedPosition = wallsStartPosition;

            // change y position of wall
            adjustedPosition.y += wallsSize / 2;

            // use i sign as switch
            float sign = Mathf.Sign(i);
            if ((i * sign) % 2 == 0)
            {
                // change x position and thickness of wall
                adjustedPosition.x += wallsSize * sign;
                scale.z *= 2;
                scale.x = 0;
            }
            else
            {
                // change z position and thickness of wall
                adjustedPosition.z += wallsSize * sign;
                scale.x *= 2;
                scale.z = 0;
            }

            // set scale and position of wall
            go.transform.localScale = scale;
            go.transform.localPosition = adjustedPosition;

            // add wall. do you even need this?
            walls.Add(go);
        }
    }
}

What i’m getting as result is this: The rectangle of the walls is 100x100 and the scale on Y is also 100 the height of the walls is 100

Walls

But i want to have a public variable type float so i can change the height of the walls but keep the size. For example to this. I changed it manual after running in the scene but i want to be able to change the height of the walls before running by changing public float: So it will keep the size 100x100 but the scale on Y the height will be 0.1 or any other value 0.1 or 0.6 or 100 or 30.

walls1

hey. you will have seen the revisions. hadn’t tested it. this should be final version.

using System.Collections.Generic;
using UnityEngine;

public class WallsTest : MonoBehaviour
{
    // using a GameObject rather than a transform
    public GameObject prefab;
    public Vector3 wallsStartPosition;
    public float width = 0;
    public float height = 1;
    public float length = 2;

    // list updated to GameObject
    private List<GameObject> walls = new List<GameObject>();

    void Start()
    {
        for (int i = -2; i < 2; i++)
        {
            GameObject go = Instantiate(prefab);
            go.transform.parent = transform;
            Vector3 scale = Vector3.one;
            Vector3 adjustedPosition = wallsStartPosition;

            float sign = Mathf.Sign(i);
            if ((i * sign) % 2 == 0)
            {
                adjustedPosition.x += (length * sign) / 2;                
                scale.x = width;
                scale.y = height;
                scale.z *= length + width;
            }
            else
            {
                adjustedPosition.z += (length * sign) / 2;
                scale.x *= length + width; 
                scale.y = height;
                scale.z = width;
            }

            adjustedPosition.y += height / 2;
            go.transform.localScale = scale;
            go.transform.localPosition = adjustedPosition;
            walls.Add(go);
        }
    }
}