in editor object placement by script in editor

i would like to make a simple grid of cubes. i can simpely do this in runtime with a for loop but the point is that i want to do this in editor.
i dont like to spend my time making grids by hand.

i have looked at the editor scripting api and have seen a basic tutoriol wich did not get me that far.

id like to have some tips on where to find a decent editor tutorial. or share some of your own experience.

i just need a bit help to get started.

Suppose you have a gameobject which has a script which generates your cubes with a function.

All you need now to do it in editing mode is to write a simple editor extension which adds a button to that script in the inspector that, upon clicking it, calls the function. Of course, you need to select the gameobject which has the generator script. The extension script itself (below) is not attached to any gameobject, you can just let it sit inside your asset folder with your other scripts.

using UnityEngine;
using UnityEditor;
using System.Collections;

public class YourCubeGeneratorScriptExtension : Editor {
	override public void  OnInspectorGUI () {
		YourCubeGeneratorScript yourCubeGeneratorScript = (YourCubeGeneratorScript)target;
		if(GUILayout.Button("Generator Cubes")) {

		if (GUI.changed) {