Home > other >  Unity - Find a specific game object within a prefab (clone)
Unity - Find a specific game object within a prefab (clone)

Time:11-06

TLDR: If possible using Bolt, how do I tell unity to find a child of a clone and not find the original. Essentially, find a child within THIS GameObject (clone), not the original prefab

Hello. I am pretty new to Unity but have been making progress using Bolt. What I have is a system that will assign a random material to a plane (Being the eye of the character) when the character is instantiated. The plane is a child of the head bone. There are two planes, a left eye and a right eye.

Left Eye Randomizer

This works well enough, but I have to create a system that copies the material from the left eye to the right eye. because if I reused the code then I would get two different random eyes. I used Find GameObject, but if I have more than one character, it will find any of that Gameobject rather than the one that is a child of clone.

Right Eye Copy Left Eye

I apologize if I did not explain this the best, but I would appreciate any help. Thank you.

CodePudding user response:

Bolt just is a visual graph using the exact same types and API.

=> Same in code or in Bolt you would rather use Transform.Find which different to GameObject.Find does not search the entire scene but rather only direct children under the given Transform component.

  • Related