Extending Unity with Editor Scripting
eBook - ePub

Extending Unity with Editor Scripting

  1. 268 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Extending Unity with Editor Scripting

Book details
Book preview
Table of contents
Citations

About This Book

Put Unity to use for your video games by creating your own custom tools with editor scripting

About This Book

  • Acquire a good understanding of extending Unity's editor capabilities for a platformer game by using Gizmos, custom inspectors, editor windows, scriptable objects, and more
  • Learn to configure and get control over your asset import pipeline using asset preprocessors
  • A step-by-step, comprehensible guide to creating and customizing a build pipeline that fits the necessities of your video game development team

Who This Book Is For

This book is for anyone who has a basic knowledge of Unity programming using C# and wants to learn how to extend and create custom tools using Unity editor scripting to improve the development workflow and make video game development easier.

What You Will Learn

  • Use Gizmos to create visual aids for debugging
  • Extend the editor capabilities using custom inspectors, property and decorator drawers, editor windows, and handles
  • Save your video game data in a persistent way using scriptable objects
  • Improve the look and feel of your custom tools using GUIStyles and GUISkins
  • Configure and control the asset import pipeline
  • Improve the build creation pipeline
  • Distribute the custom tools in your team or publish them in the Asset Store

In Detail

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.

Style and approach

This book uses a step-by-step approach that will help you finish with a level editor tool, a custom configuration for the asset import pipeline, and a build pipeline totally adjusted to the video game.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Extending Unity with Editor Scripting by Angelo Tadres in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Games. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785281853
Edition
1

Extending Unity with Editor Scripting


Table of Contents

Extending Unity with Editor Scripting
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Editor Scripting
Overview
Editor scripting basics
What is an editor script?
The Editor folder
Introducing Run & Jump
Playing the video game
Creating a new level
The Level Creator tool
Defining the chapter goals
Preparing the environment
Performing automation
Summary
2. Using Gizmos in the Scene View
Overview
Defining the chapter goals
Creating gizmos through code
The OnDrawGizmos and OnDrawGizmosSelected methods
Adding gizmos using the DrawGizmo attribute
The Gizmos class
DrawCube
DrawWireCube
DrawSphere
DrawWireSphere
DrawRay
DrawLine
DrawIcon
DrawGUITexture
DrawFrustrum
Adding a structure to our levels
Implementing the gizmo grid
Implementing the snap to grid behaviour
Summary
3. Creating Custom Inspectors
Overview
Defining the chapter goals
Upgrading the Level class
Understanding how an inspector works
Creating a custom inspector
Using the CustomEditor attribute
Playing with the inspector message methods and target variable
Adding the GUI elements
Implementing the resize feature
Using buttons to trigger actions
Working with layouts
Creating complex layouts
Improving the inspector without custom inspectors
What is a Property Drawer?
Built-in Property Drawers
Range
Multiline
TextArea
ContextMenu
ContextMenuItem
Built-in Decorator Drawers
Header
Space
Tooltip
Creating you own Property Drawers
Using drawers inside a custom inspector
Using SerializedObject and SerializedProperty
Summary
4. Creating Editor Windows
Overview
Defining the chapter goals
Creating the base for an editor window
Using the EditorWindow class
Playing with the EditorWindow message methods
Using Hotkeys to trigger menu items
Implementing the Palette
Creating a category system
Finding assets using the AssetDatabase class
Implementing the GUI for the Palette
Creating tabs
Creating a scrollable area
Integrating the Palette with the Level Creator tool
Creating an event
Subscribing to an event
Summary
5. Customizing the Scene View
Overview
Defining the chapter goals
Defining the Editor modes
Customizing the Scene View
Using the OnSeceneGUI message method
Playing with the Scene View tools
Controlling the focus over our game objects
Detecting Scene View events
Getting the mouse position
Capturing mouse events
Implementing the Level Creator modes
The View mode
The Paint mode
The Erase mode
The Edit mode
Using the Handles class
Adding the final details to Level Creator
Using hiding flags
Summary
6. Changing the Look and Feel of the Editor with GUI Styles and GUI Skins
Overview
Defining the chapter goals
Changing the look and feel of the Level Creator tool
Using GUIStyles in our GUI components
Working with the GUIStyleState instances
Changing the look and feel using a simpler approach
Creating a GUISkin asset
Integrating and using a GUISkin
Summary
7. Saving Data in a Persistent Way with Scriptable Objects
Overview
Defining the chapter goals
Preparing the environment
Updatable gravity in levels
Playing with gravity
Implementing a Scriptable Object
Creating the data class
Generating an asset to contain the data class
Integrating the Scriptable Object with the level
Updating the Level and the LevelInspector class
Tweaking the level settings in the play mode
Summary
8. Controlling the Import Pipeline Using AssetPostprocessor Scripts
Overview
Defining the chapter goals
Using the AssetPostprocessor class
Improving the import pipeline
Overwriting the background and level piece assets settings
Using a DLL file for the AssetPostprocessors
Creating and setting up a DLL project
Integrating the DLL file to the main project
Summary
9. Improving the Build Pipeline
Overview
Defining the chapter goals
Preparing the environment
Automating the BuildPipeline class
Adjusting the player settings
Using the BuildPipeline class
Creating an editor window and learning about EditorPrefs to persist data
Adding version control to your project
Interacting with external scripts
Displaying the build information in the video game
Using the bash script in our pipeline
Distributing your video game using AppBlade
Creating an AppBlade account
Uploading the build
Summary
10. Distributing Your Tools
Overview
Defining the chapter goals
Preparing the environment
Sharing code using a Unity Package
Creating a package
Importing a package
Sharing code using Git submodules
Creating a submodule
Using a submodule
Publishing in the Asset Store
Installing the Asset Store Tools
Becoming a publisher
Uploading the package
Using the Mass Labeler
Uploading and submitting the...

Table of contents

  1. Extending Unity with Editor Scripting