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.