Reference to any last gameobject

Hi to all,

After research, I could not find a response or at least if you think I did not searched a lot, I am here with a simple question : if I click on the object A, the child of Object A appears. If I touch on the object B, the child of Object B appears but the child of last clicked (Object A or C or D etc…) disappears at same time too.

There is anyway to reference to last any touched/clicked/collided gameobject ?

Thanks a lot

Hello. You say you searched a lot, but what are you searching…? You just need to make a simple script… If you dont know how, then you should take your time and learn the basics, pends next hours learning basic scripting for unity…

Just need to make a variable to store last touched object…

GameObject TouchedObject;
GameObject LastTouchedObject;

Touching(SomeObjectJustTouched)
{
LastTouchedObject = TouchedObject;
TouchedObject = SomeObjectJustTouched;
}

Bye.