How can i limit int variables in the Inspector so the user will not be able to enter the numbers 2 or not same numbers ?

In the top of the script:

public int mapWidth = 10;
public int mapHeight = 10;

Then in a loop:

private void Generate()
    {
        if (objects.Count > 0)
            objects = new List<GameObject>();

        if (Node == null)
            Node = GameObject.FindGameObjectWithTag("Main Node");

        for (int x = 0; x < mapWidth; x++)
        {
            float positionWidth = Spacing * (float)x;

            for (int z = 0; z < mapHeight; z++)
            {
                float positionWidth1 = Spacing * (float)z;
                GameObject block = Instantiate(Node, Vector3.zero, Node.transform.rotation) as GameObject;
                block.transform.parent = transform;
                block.transform.localPosition = new Vector3(positionWidth, 0, positionWidth1);
                block.transform.localScale = new Vector3(nodeScale.x, nodeScale.y, nodeScale.z);
                block.tag = "NodeDestroyable";
                objects.Add(block);
            }
        }
    }

But i want to add two rules:

The user will not be able to enter as int numbers 2 or less. So mapWidth or/and mapHeight will never be 2 both or one of them and also the numbers in both int variables should be the same like 7 and 7 or 10 and 10 but not 8 and 9 or 67 and 4.

If the user enter this numbers prevent from him to generate.
And i have a button that i click to Generate so i need also to take care the button maybe somehow to enable/disable the button: This is the button class:

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

[CustomEditor(typeof(Generator))]
public class GenerateButton : Editor
{
    public override void OnInspectorGUI()
    {
        Generator Generate = (Generator)target;
        
        if (GUILayout.Button("Generate New Map"))
        {
            Generate.GenerateNew();
        }

        DrawDefaultInspector();

        if (GUILayout.Button("Destroy Nodes"))
        {
            Generate.DestroyNodes();
        }
    }
}

The idea is to prevent from the user to enter this values and also to prevent the user from clicking the button if the values are wrong.

About enable/disable the button i can’t find any way to do it.
I can disable the whole guilayout but it will disable also the other variables i want to enable/disable only the button.

There is something on a MonoBehaviour called OnValidate() which allows you to check
variables in the inspector and reset them etc for example:

public int NumberOfEnemies; //set in inspector

void OnValidate() {
if (NumberOfEnemies > 5)
NumberOfEnemies = 5; // Reset to 5 when it is tried to be set higher than 5
}

Maybe Range is what you are looking for.

[Range(2, 10)]
public int mapWidth = 10;
[Range(2, 10)]
public int mapHeight = 10;

And if you want both numbers to be always the same, why have two numbers in the first place?

[Range(2, 10)]
int mapSize = 10