can i make a search in Unity scene/game ?
for example
i have 3 balls, red, yellow and green
when i am playing the game i do not know where the green ball is
so i make a search to find the green ball and unity make the green ball highlighted or zoom to that object
If you Mean inside the Scene View, you can use the search field of the hierarchy window and press F to focus and zoom in if you selected the targeted GamObject.
If you what the functionality inside the game view, you have to code it yourself.
Thanks
yes i mean inside game.
Could it be done in both JS and C# ?
Yes, you can either tag them accordingly or if they have a unique component use that. For example.
GameObject target = GameObject.FindGameObjectsWithTag("Tag");
or
Object.FindObjectOfType(typeof(Component)) as Component
Where Component is the unique component of that game object.
1 Like