Book Image

Extending Unity with Editor Scripting

By : Angelo R Tadres Bustamante
Book Image

Extending Unity with Editor Scripting

By: Angelo R Tadres Bustamante

Overview of this book

One of Unity's most powerful features is the extensible editor it has. With editor scripting, it is possible to extend or create functionalities to make video game development easier. For a Unity developer, this is an important topic to know and understand because adapting Unity editor scripting to video games saves a great deal of time and resources. This book is designed to cover all the basic concepts of Unity editor scripting using a functional platformer video game that requires workflow improvement. You will commence with the basics of editor scripting, exploring its implementation with the help of an example project, a level editor, before moving on to the usage of visual cues for debugging with Gizmos in the scene view. Next, you will learn how to create custom inspectors and editor windows and implement custom GUI. Furthermore, you will discover how to change the look and feel of the editor using editor GUIStyles and editor GUISkins. You will then explore the usage of editor scripting in order to improve the development pipeline of a video game in Unity by designing ad hoc editor tools, customizing the way the editor imports assets, and getting control over the build creation process. Step by step, you will use and learn all the key concepts while creating and developing a pipeline for a simple platform video game. As a bonus, the final chapter will help you to understand how to share content in the Asset Store that shows the creation of custom tools as a possible new business. By the end of the book, you will easily be able to extend all the concepts to other projects.
Table of Contents (12 chapters)
11
Index

What this book covers

Chapter 1, Getting Started with Editor Scripting, introduces you to Unity editor scripting and explains why this is useful to improve the development workflow. In this chapter, the video game, Run & Jump, which is used as a base for this book is presented.

Chapter 2, Using Gizmos in the Scene View, explains how to use gizmos to display debug information in the Scene View. Here, we implement a grid with gizmos to be used as guides in the level editor.

Chapter 3, Creating Custom Inspectors, discusses how to improve the way the Unity components and scripts are presented in the inspector window, creating custom inspectors and using property and decorator drawers. In addition to the this, you will learn how to start adding and using the editor GUI components. Here we go through the process of making a custom inspector for the class responsible for the level logic in Run & Jump.

Chapter 4, Creating Editor Windows, covers how to create an editor window to present information and interact with features in a custom tool. Using some of the editor GUI skills developed in the last chapter, we create a Palette window, which is a quick and visual way to access the prefabs used as building pieces for the video game levels, grouping them by categories.

Chapter 5, Customizing the Scene View, dives into how to add the editor GUI components directly to the Scene View and capture specific events to expand their capabilities. Step by step, we add GUI components to enable and disable different modes we are going to implement on the level editor, like View, Paint, Edit and Erase, changing the way how the user interacts with the tool.

Chapter 6, Changing the Look and Feel of the Editor with GUI Styles and GUI Skins, explains how to change the look and feel of the Unity editor custom tools. Here we finish the level editor investing our time modifying the appearance of it.

Chapter 7, Saving Data in a Persistent Way with Scriptable Objects, describes how to save data in Unity and manipulate it as a reusable asset using scriptable objects. We walk through the process of reallocate certain properties from the class responsible for the level logic to a scriptable object class, making them reusable across levels.

Chapter 8, Controlling the Import Pipeline Using Asset Postprocessor Scripts, demonstrates how to improve and control the importing pipeline using Asset Postprocessor scripts. We work in automating the process of changing the import settings of the assets imported to the project to make them usable by the video game in an easy way.

Chapter 9, Improving the Build Pipeline, discusses how to automate and improve the build creation pipeline modifying the Unity player settings through code and calling scripts outside Unity. Here, we create a basic build pipeline for Run & Jump that publishes the mobile version of it in a distribution platform called AppBlade.

Chapter 10, Distributing Your Tools, concludes this book by showing how to use Unity packages and Git submodules for custom tools distribution, suitable for sharing inside a team, and how to sell content on the Asset Store.