OK, first things first, to make this work, you need to assign your models to your object via the inspector, and not using GameObject.Find
- You also have some redundancy in you code.
So your code should look something like this:
var lightsOn: boolean;
// Inspector variables
var modelOff: GameObject;
var modelOn: GameObject;
function Update(){
modelOff.SetActiveRecursively(!lightsOn);
modelOn.SetActiveRecursively(lightsOn);
}
A couple of programming notes here:
- About the
if
-else
statement:
if
takes a boolean statement, i.e.
a statement that returns either true
or false - The body of the if
will
get executed if that statement
returns true, otherwise the body of
the else
is the one to get
executed, you probably know that.
Now, lightsOn
is a boolean
variable, it returns either true or
false right? - Let’s assume that the
light was turned on (so lightsOn is
true) - saying if (lightsOn == true)
is just like saying if (true == true)
- Redundant, right?
- In your code, you wrote:
if (light was on)
// do something
if (light was off)
// do something else Now tell me, can a light be both on and off
at the same time?
- This is what
the else
statement is for - using
an if-else
means that it’s either
this OR that. The way you did it,
both if statements will get checked,
if the light was on, the 2nd if is
redundant because of course it’s not
off
A Unity note:
Notice there’s something not right about my code? - I’m calling SetActiveRecursively
on both models EVERY frame, why? there’s no need to. All I need to do, is toggle the models upon turning on/off the light, right? - So how can I write something like “Whenever the light changes states (on/off) → Toggle the models”? - o.O
First, here’s your ToggleModels function:
function ToggleModels()
{
model_one.SetActiveRecursively(!model_one.active);
model_two.SetActiveRecursively(!model_two.active);
}
If that confused you, toggling
something means switching whatever state it was at before, to the opposite state - so if the the model was ‘on’ - toggling it is switching it ‘off’ - (!on) - if it was ‘off’ toggling it == !off = on 
To answer our previous question, you need to use ‘events’ - Basically you should have an onLightChanges
or onLightToggles
event that will fire when the light gets turned on/off - Let you object ‘subscribe’ to that event, so that whenever it ‘fires’, it toggles the models 
More about events could be found here, here and here.
Btw I highly advice you to invest the time learning C#.
Oh and, almost forgot, why did your original code not work? - Because GameObject.Find("something");
will search in your entire scene and return the first instance of “something” it finds, if any. - In your case, when you duplicate your ‘object’, the models (children) gets duplicated as well, but with the SAME names, like:

So, GameObject.Find
actually did its job pretty darn good, it gave you back the first instances of the models your were looking for
- Which is why, it’s best to make the models public variables in your object script (make your object even a prefab) and assign them through your inspector 