An editor extension to have an object-creator GameObject, with buttons to instantiate different pickups at cross-hair object location in scene
If a level designer wishes to place each pickup carefully "by hand", we can still make this easier than having to drag copies of prefabs manually from the Projects panel. In this recipe, we provide a "cross-hairs" GameObject, with buttons in the Inspector allowing the game designer to create instances of three different kinds of prefab at precise locations by clicking the appropriate button when the center of the cross-hairs is at the desired location.
A Unity Editor extension is at the heart of this recipe and illustrates how such extensions can allow less technical members of a game development team to take an active role in level creation within the Unity Editor.
Getting ready
This recipe assumes you are starting with the project Simple2Dgame_SpaceGirl
setup from the first recipe in Chapter 2, Inventory GUIs.
For this recipe, we...