is there any way to focus (select) in hierarchy by script

i have runtime changing mesh renderer and if i didnt select that gameobject in hierarchy, it doesnt update the mesh.
so i need to select that game object by script. i have tried some(selection.activeobject) solution and actually it worked but in build, this script didnt work.(build have no fail)

Hello.

You need to give more info… How do you pretend to select the objects? By mouse click? by menu navigate? by camera looking at it…?

You need to learn to use RAYCAST so you can select the object where the raycast hits.

Go find tutorials about this. Learn adn try try try.

good luck!ª