A simple custom editor inspector script for editing spawn\waypoint positions.
This custom inspector is built using the new, powerful Unity UIToolkit. Thus this serves as an educational example on how to use this new UI package.
Spawn positions are stored in a List<Vector3>
container in an instance of a ScriptableObject called SpawnDatabase
.
When an instance of the ScriptableObject SpawnDatabase
is selected in the Project window, selected spawns from the list in the custom inspector are shown in the scene view. For instance spawns 1, 4, 6 and 9 are selected and they are shown in the scene view.
To keep things simple, all you need to do is:
- Make sure that you use Unity 2021.3 or newer version
- copy
SpawnDatabase.cs
andSpawnCustomInspector.cs
into yourScripts
folder
- Create a
SpawnDatabase
instance throught the assets menuCreate/SO/Spawn Database
- Select the previously created instance of
SpawnDatabase
ScriptableObject - Spawn positions appear in the scene view as movable objects. You can now use the scene view with the custom inspector to properly place your spawn positions
- Add new spawn positions using the scene view (by pressing Ctrl-D on a selected spawn)
- Add
Copy to Clipboard
button. When clicked, the spawn positions list is serialized into JSON and the resulting string is copied to the clipboard. - Change wireframe cube colors to
Green
- Enhance layout\styles.
MIT License.