Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Find all Objects with a specific value of a variable and show/hide it in scene

Discussion in 'Getting Started' started by malte93, Dec 19, 2015.

  1. malte93

    malte93

    Joined:
    Oct 12, 2015
    Posts:
    2
    Hello there,

    I think this is a very basic question but I don't know how to do this.
    I am making some kind of instruction for building with lego. The idea is to press a button (next/previous) to show the next lego blocks. Its basicly a step-by-step instruction. I thought that I place all the lego blocks in the scene and just hide them all until I need them for the next step.. Is it possible to give a gameobject (for example a cube) a variable like step = 42?? So when I press the next-button my currentStep is 42 and all gameobjects with the variable step <= 42 are shown?

    pseudo code:
    public void update(){
    show all Gameobjects where step <= currentStep;
    }

    I hope you understand me..
    I really don't know how to do this...