How can i create two buttons in the inspector in editor with space between the buttons without overriding existing other controls ?

By the default this is the script attached to a empty gameobject in the hierarchy:

namespace CBX.TileMapping.Unity
{
    using UnityEngine;
 
    public class TileMap : MonoBehaviour
    {
        public GameObject Prefab;
        public bool randomScale = false;
 
        public int Rows;
        public int Columns;
        public float TileWidth = 1;
        public float TileHeight = 1;
 
        [HideInInspector]
        public Vector3 MarkerPosition;
 
        public TileMap()
        {
            this.Columns = 20;
            this.Rows = 10;
        }
 
        private void OnDrawGizmosSelected()
        {
            var mapWidth = this.Columns * this.TileWidth;
            var mapHeight = this.Rows * this.TileHeight;
            var position = this.transform.position;
 
            Gizmos.color = Color.white;
            Gizmos.DrawLine(position, position + new Vector3(mapWidth, 0, 0));
            Gizmos.DrawLine(position, position + new Vector3(0, mapHeight, 0));
            Gizmos.DrawLine(position + new Vector3(mapWidth, 0, 0), position + new Vector3(mapWidth, mapHeight, 0));
            Gizmos.DrawLine(position + new Vector3(0, mapHeight, 0), position + new Vector3(mapWidth, mapHeight, 0));
         
            Gizmos.color = Color.grey;
            for (float i = 1; i < this.Columns; i++)
            {
                Gizmos.DrawLine(position + new Vector3(i * this.TileWidth, 0, 0), position + new Vector3(i * this.TileWidth, mapHeight, 0));
            }
         
            for (float i = 1; i < this.Rows; i++)
            {
                Gizmos.DrawLine(position + new Vector3(0, i * this.TileHeight, 0), position + new Vector3(mapWidth, i * this.TileHeight, 0));
            }
 
            Gizmos.color = Color.red;  
            Gizmos.DrawWireCube(this.MarkerPosition, new Vector3(this.TileWidth, this.TileHeight, 1) * 1.1f);
        }
 
        public void GenerateNew()
        {
 
        }
 
        public void DestroyBlocks()
        {
 
        }
    }
}

And this is how it looks like in the editor in the inspector:

Now i created another script:

using UnityEngine;
using System.Collections;
using UnityEditor;
using CBX.TileMapping.Unity;

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

        if (GUILayout.Button("Destroy Blocks"))
        {
            Generate.DestroyBlocks();
        }
    }
}

And now the editor in the inspector it looks like this:

All the properties variable checkboxes now gone or hided by the two buttons.

How can i add the two buttons and also show the checkboxes and all other controls/properties ?
And how can i add some space between the two buttons so i don’t click the wrong one by accident ?

In your editor script, in ‘OnInspectorGUI()’ add DrawDefaultInspector (). So your code should now look like this:

using UnityEngine;
 using System.Collections;
 using UnityEditor;
 using CBX.TileMapping.Unity;
 
 [CustomEditor(typeof(TileMap))]
 public class CustomButton : Editor
 {
     public override void OnInspectorGUI()
     {
         TileMap Generate = (TileMap)target;

         DrawDefaultInspector();

         if (GUILayout.Button("Generate Map"))
         {
             Generate.GenerateNew();
         }
 
         if (GUILayout.Button("Destroy Blocks"))
         {
             Generate.DestroyBlocks();
         }
     }
 }

This will show your variables from your other script, while drawing buttons on the UI.
Hope this helped!

TBART82