Game Development Reference
In-Depth Information
Customizing the Unity Editor
The Unity Editor is a powerful, general purpose game development tool. Nevertheless,
there are times during development when you probably wished the editor offered a
specific feature that it doesn't have or behaved in a particular way, simply because it
would be more convenient for you and your specific game. Maybe you'd like the path
editing features, batch renaming functionality, or mesh creation tools, among others. In
such cases, you can search the Asset Store for add-ons that meet your needs. But even
then, you may still not find what you need. Consequently, the focus then turns to how
the editor can be adapted or customized to achieve your purpose. Thankfully, there are
many ways Unity can be changed as a tool, and this chapter focuses on particular case
studies. First, it explores how to create a Batch Rename tool for renaming multiple
selected objects in one operation. Second, it covers how to create a color range field
in the Object Inspector to blend between two colors using a slider. Third, it explores
how to expose public C# properties in the Object Inspector for both setting and getting
values. Lastly, it covers how to use C# attributes to create a localization toolkit that
allows you to automatically change all in-game strings to a chosen language
(English, French, and so on) at the touch of a button.
Batch renaming
When creating scenes with multiple enemies, power-ups, props, or other object
instances, you'll typically use the duplicate feature to clone objects ( Ctrl + D ). This
leads to many objects sharing the same name. Now, while there's nothing technically
wrong in name duplication per se, it's both inconvenient and untidy. It results in a
hierarchy panel of many identically named objects, and it's practically impossible to
distinguish between specific objects by their name alone. Furthermore, object searches
in script using the GameObject.Find function cannot be relied on to retrieve the
specific object that you need, since it could return any one of the identically named
objects. The solution, then, is to name each object uniquely and appropriately.
But doing this can be tedious, especially if you're working with many objects.
Thus, there's a need for a Batch Rename tool.
Search WWH ::




Custom Search