Click to Spawn

This component is an Editor tool and not for in-game use. It can be used in Editor Mode within the Scene Window or when the Editor is in Play Mode. In Play mode, objects are not retained in your scene. In Editor Mode only, Objects are retained and can be used within your game.
Objects can be Primitives or Prefabs and are spawned in world space, displaying the Vector coordinates in the log. The Object can be centred on the Terrain or Plane, or placed above it using offsets.
First, you must add the ClickToSpawn prefab to your scene or add the script to an empty gameobject. The Inspector window is as shown below when the Use Prefab is selected.
Simply drag your prefab into the appropriate slot, set the prefab size, and choose which mouse button you wish to use to spawn prefabs in your scene. Point the mouse within the Scene window, click the chosen mouse button, and your prefab will appear in your scene. The World co-ordinates will be shown in the Log.
If you Spawn objects or prefabs while in Play Mode, they will be destroyed when exiting Play Mode. If not in Play Mode, they will remain.
To spawn primitives, select the Use Primitives check box, and choose which primitive you want. Select the size, and any offset you want. If no Offset is entered, the primitive will be centered on the raycast mouse position.
This component can be used for populating your scene with primitives or prefabs such as trees, rocks, or vegetation, and can also be used for populating Game Characters throughout your world. It is also useful for gathering world co-ordinates of potential objects with the scene by placing primitives while in play mode and saving the Vectors that are displayed in the log.
If you do not wish to use the PreFab, simply add the clicktospawn script to any gameobject in your scene hierarchy.