Accessing one gameobject from many clones

Hi there,
I’ve been lately playing around with game objects, and of course some questions appeared to which i will hopefully find answers.
If let’s say i have two game objects with two children each, and both main and children have same names (clones), how is it possible to access only one of them, let’s say the second one ?

//Hierarchy illustration

Object
   part1
   part2

Object
   part1
   part2

For now i managed to code it working, but only if using one GO. Like this,

if(Input.GetKeyDown(KeyCode.X)){
GameObject.Find ("part1").SetActive(false);} //disables first GO in hierarchy with name part1, on a press of the button

As i understand, it is impossible doing this using gameobjects and .find.
If we imagine that both of these objects are cubes with colliders attached, how would i disable (only on a press of the button) the one I’m colliding with? (but if im not colliding it wouldn’t disable)

Thanks!

transform.GetChild(0) returns part 1 of object whose transform we are referring from this script (script is attached to the same object, that’s why we can access the object’s transform by typing “transform” keyword

if(Input.GetKey(KeyCode.X && transform.GetChild(0) != null)){ //if you are getting something from button and the child exists
      transform.GetChild(0).SetActive(false)   is what you want
}

As far as I understand your game objects are clones which u instantiate from prefabs right?
And you trying to manipulate object from your avatar once you collide it right?

Then why don’t you apply script logic on game object itself (prefab) instead of searching that object from your avatar? then you can set object trigger to fire event on colliding and check user input on object itself like this:

//pseudo-code = not real code, just logic:   
if(collider == <player_avatr> && input == <some_key>)
{
   //do some stuff
}
else
{
  //I did collide with something else but not a player, 
  //or input didnt match
  //do nothing
}

So instead of searching game object from player, let object it self detect collision and with whom it was collided