Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Extending Unity with Editor Scripting
  • Table Of Contents Toc
  • Feedback & Rating feedback
Extending Unity with Editor Scripting

Extending Unity with Editor Scripting

By : Angelo R Tadres Bustamante
4.7 (7)
close
close
Extending Unity with Editor Scripting

Extending Unity with Editor Scripting

4.7 (7)
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)
close
close
11
Index

Preparing the environment


Before we start playing with Scriptable Objects, we are going to play with the gravity of a custom level an see what happens.

Updatable gravity in levels

Right now, if you want to adjust the gravity of a level you must to make the changes before pressing the Play button in order to see results.

The Level class has a method called SetGravity, which is responsible for taking the value of the gravity property and applying it to the Physics 2D settings in Unity. You don't need to take care about how this is implemented. The only thing we must to do is to integrate this in the custom inspector we created for the Level class, so each time the gravity value changes, the SetGravity method will take care of the rest.

Let's update the LevelInspector class to achieve this. At the end of the DrawLevelDataGUI method, add the following line of code:

_myTarget.SetGravity();

This method checks the value of the gravity and updates this if necessary. Pretty simple!

Playing with gravity

Using...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY