Search Unity

Lights

Discussion in 'Scripting' started by elmnas, Mar 4, 2010.

  1. elmnas

    elmnas

    Joined:
    Mar 4, 2010
    Posts:
    2
    Hello Guys

    I have built a apartment with 20 lights in the rooms

    Example I have 5 lights in the kitchen, 5 lights in the livingroom etc.

    How do I write a script to control the 5 lights in the kitchen with just 1 button?

    and also 1 button to control the lights in the livingroom?

    Please help me!


    Thank you!
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    write a component with an array Light[] kitchen; for example, then fill it in the editor and then make a function that loops through all elements in the array and disables them / enables them
     
  3. elmnas

    elmnas

    Joined:
    Mar 4, 2010
    Posts:
    2
    Hi there! can you please help me to write this. haah I cant much about java script. I sitting here in school I will present this tomorrow for my class haaha. maybe I have took some water over my head but. if you would to like. I should appreacite it :)