Short summary:
Shows a collection of all the prefabs in the project.
You can easily select/scale/rotate object with the menu or hotkeys.


> The Window.

> In the editorscene.

> Editor Window basics.

> Finding objects in your project.

> How to display icons.

> OnScene UI.

The Window:

The tool is used to create a map without needing to search in folders for the correct prefab.
This window contains all the prefabs in your project so you can easily find them.
You can also use the search bar to filter all the prefabs.

When you select a prefab an example gameobject will be created in the scene.
This object will show how it looks when you place it.

EditorTool MapEditor Searchbar
EditorTool MapEditor Scaling

In the editorscene:

When a prefab is selected you can change the size or rotation with hotkeys.
This means that you don’t have to select every gameobject that you have placed to change the rotation or the size.
Because of this you will spend a lot less time on the creation of a scene.

Editor Window basics:

EditorScript Example

There are two kinds of editor script:
1. A Custom editor for a script. (used to display variables of a script differently)
2. An Editor window. (standalone window that doen’s need other scripts)

How to create an editor script:
First, you need to create a folder in you’re Unity project called: “Editor“.
This is the folder that you use to store your editorscripts, This is needed because Unity needs to know what is and isn’t an editorscript.
When you have created you’re editor script you can start with the code.
For an editorscript to work you need to add “using UnityEditor” in your script.
After that you need to be able to initialize the editor window from the UnityMenu (Toolbar).
This can be done by writing “[MenuItem(“NameOfToolbarButton/NameEditorWindow”)]” above the static void.
And as last you need OnGUI to visualize the variables on the window.

Editor Script Find Prefab Objects

Finding objects in your project:

You can use “Directory.GetFiles(“Assets/”, “*.prefab”, SearchOption.AllDirectories)” to find the locations of every prefab in your project.
This will return an array with strings to all available prefabs.
Now you can loop trough the prefabs in make it a Object, This can be done with: “AssetDatabase.LoadAssetAtPath()“.
After that you can store a reference of the prefab as a GameObject.

How to display icons:

To create custom buttons with icons you need to use: “GUI.Button“.
First, we create “GUIContent” to store the name of the prefab, This can be used to store data like: an image or a text. 
After you have created the Content, you can start with the button itself.
To create a rectangle button (like I use for my tool) you need to use a Rect to set the position and size of the button.
The variables you give to the Rect are used to define the Min and Max position of the button.

Unity Rect Example

For Example: “new Rect(10,10,20,20)
This would mean that the button starts at (x10) and (y10) and ends at (x20) and (y20), 
So the button will have the size of 10 by 10 pixels

This can be used with the button and you will and up with:
if (GUI.Button(new Rect(10,10,20,20), GUIContent ))
//Do this

OnScene UI: