Game Objects and Visibility

This may sound a little odd and more ignorant than anything since I am just learning Unity’s structure but I am trying to determine an easier way to do something versus creating a scene file for each level in my test app.

If I am dealing with a set of patterns of blocks in a scene and these patterns are pre-defined. Instead of creating a new scene file for each level to represent each pattern of blocks, is there a way to make visible or invisible each of the 3d Elements I want to display for each particilar level.

i.e I have a 5x5 grid with each cell being a block, different levels have different combinations of these cells being visible or not to form a pattern. Can I at level startup time just make the ones I need visible for that level and hide the others? This way I do not have to have a different scene file for each level but generate each level based on the known pattern for that level.

Thanks in advance.

Chris

Having many different scenes is not bad per se. With prefabs and scripts you can make most parts of the scenes common to all and only the placement specific for each one (so that you don’t have to update all scenes to change the color of the blocks, for example).

The other approach, to create or hide the blocks when the level loads, isn’t bad either. It depends on what you want to do.

The easiest way to hide a game object is to make it inactive.
To do so by script, you could do:

var go :GameObject;

function Start() {
    // This deactivates (hides) the game object but not its children:
    go.active = false;
    // This deactivates the game object as well as its children:
    go.SetActiveRecursively(false);
}