Book Image

Extending Unity with Editor Scripting

Book Image

Extending Unity with Editor Scripting

Overview of this book

Table of Contents (18 chapters)
Extending Unity with Editor Scripting
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding the final details to Level Creator


The Level Creator is almost ready, but before finishing this chapter, let's make a few improvements to make this tool better.

Using hiding flags

Currently, each time we paint pieces on the level, they are created and nested in the level game object. We are still able to access the objects directly; this means it is possible to move a piece by error outside the grid. Let's take a look at the following screenshot:

To control the visibility of the level pieces in the hierarchy, we are going to use HidingFlags, bit masks that control object destruction, saving, and visibility in inspectors. Here is a list of available flags that could be applied to Unity objects:

  • None: A normal and visible object. This is the default.

  • HideInHierarchy: It does not appear in the hierarchy.

  • HideInInspector: It is not visible in the inspector.

  • DontSaveInEditor: It is not saved to the scene in the editor.

  • NotEditable: It is not editable in the inspector.

  • DontUnloadUnusedAsset...