Beginning Unity Editor Scripting: Create and Publish Your Game Tools

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Learn about editor scripting in Unity, including different possible methods of editor customization to fit your custom game workflow or even to create assets that could be published on the Asset Store to earn a passive income. The knowledge of editor scripting, although rarely covered in books, gives a game developer insight into how things work in Unity under the hood, which you can leverage to create custom tools that empower your unique game idea. 

This book starts with the very basics of editor scripting in Unity, such as using built-in attributes to customize your component’s editor and creating custom editors and windows with  IMGUI and UI Toolkit. Next, we move to a general use case example by creating an object spawner EditorTool for the scene view. Later, we dive straight to in-depth stats and detailed case studies of two Unity assets: ProArray and Rhythm Game Starter. Here you’ll get more context on how editor scripting is used in published assets.

You will also learn how to set up a better workflow for editor scripting, asset publishing, maintenance, and iterative updates. You will leverage the power of modern web technology to build a documentation site with GitBook and DocFX. Finally, you will see some tips and tricks for automating asset versioning and changelogs. 

What You Will Learn

  • Get started with Editor scripting in Unity
  • Work with advanced editor topics such as custom EditorWindows and EditorTool
  • Structure your C# code with namespaces and asmdef
  • Use IMGUI and UI Toolkit for creating editor GUIs
  • Master packaging and selling your own editor tools
  • Set up a better workflow for asset publishing, maintenance, and iterative updates

Who This Book Is For

Readers who want to learn about editor scripting to improve their game-development process and create tools for themselves. Moderate experience with C# and a fundamental knowledge of Unity is expected.


Author(s): Benny Kok
Publisher: Apress
Year: 2021

Language: English
Pages: 280
City: New York

Table of Contents
About the Author
About the Technical Reviewers
Acknowledgments
Introduction
Chapter 1: Getting Started
Unity’s Modularity
Possibilities of Editor Scripting
Creating Your Own Asset or Editor Extension
What to Expect in the Book
Setup and Tips
Summary
Chapter 2: Customizing the Editor with Attributes and Callbacks
Using the Property Attribute
The Range Attribute
The Header Attribute
The Multiline and TextArea Attributes
The Tooltip Attribute
The HideInInspector Attribute
The SerializeField Attribute
The Space Attribute
Other Useful Attributes
ContextMenu
The HelpURL Attribute
AddComponentMenu
ExecuteAlways
RequireComponent
MonoBehaviour Editor Messages
OnValidate
OnDrawGizmos
OnDrawGizmosSelected
Reset
Summary
Chapter 3: Custom Editor with IMGUI
Differences Between Editor Scripts and Normal C# Scripts
Editor Folder
Custom Editor Script Example
#if Preprocessor
Assembly Definitions
Custom Editor
CanEditMultipleObjects
IMGUI Debugger
Editor GUI Layout
Layout Options
Coloring the Button
Custom Undo/Redo
Drawing the Property Field Yourself
Getting a Value in SerializedProperty
HelpBox
Property Drawers
Custom Property Attribute
Custom Serializable Class
Custom Editor Window
Extending EditorWindow
GenericMenu
Summary
Chapter 4: Custom Editor with  UI Toolkit
Custom Editor with UI Toolkit via C#
Displaying a Button
Detecting a Button Click
Inline Styling in Code
UI Toolkit Debugger
UI Toolkit Samples
Layout in UI Toolkit
Justify-Content
Property Field
HelpBox
Value Change Callback
Final Layout
Custom PropertyDrawer with UI Toolkit via C#
Custom Editor Window with  UI Toolkit via UI Builder
Summary
Chapter 5: Object Spawner Tool Using EditorTool and ScriptableObject
Overview of the Tool
EditorTool
ScriptableObject
Setting Up the Project Structure
Scriptable Structure
Implementing a Custom EditorTool
Wrapping Up
Summary
Chapter 6: Case Study: ProArray
Idea and Concept
Implementation
Structure
Editor Foldout Layout
Custom Toolbar Layout
Custom Animatable Properties Support
Component Icon
Scene Gizmos Icon
Hierarchy Overlay
Toggle Box
Prerelease Preparation
Post-Release Analysis
Summary
Chapter 7: Case Study: Rhythm Game Starter
Idea and Concept
Implementation
Editor Midi Import
AssetPostprocessor
“Abusing” PropertyDrawer in Rhythm Game Starter
Custom Sequence Editor
Onboarding Experience
Prerelease Preparation
Post-Release Analysis
Summary
Chapter 8: Asset Workflow for Publishing
Version Control with Git
Do You Git?
Git init
Git Ignore
Git LFS
Git Client
Remote
Commit and Push
Submodules Are Key
Changelog and Versioning
Standard-Version
Using standard-version
Documentation
GitBook
Creating a Space
Editing Content
Wrapping Up
DocFX
Installing DocFX
Setting Up a DocFX Project
C# Code Documentation
Basic Customization in DocFX
Web Hosting
Conclusion
Chapter 9: Package Distribution and Publishing
UPM Packages
Creating a Local Embedded Package
Publishing to GitHub
Publishing to OpenUPM
Unity Asset Store
Publisher Portal
Drafting Packages
Description
Media
Pricing
Uploading Packages
Publisher Forum
Conclusion
Chapter 10: Conclusion
Key Takeaways
Afterthoughts
Tips
Further On
Index