Highlighting / Focusing on an Editor Window Through Code

Is there a way to make a specific window in the editor (say the Hierarchy, or the Project window) selected through code? As in, if it were the Hierarchy window, the current selected gameobject would be blue-highlighted instead of gray?

I have a component script that automatically selects certain objects in the hierarchy, and want the hierarchy window to become the focused window once it’s selected them.

Thanks!

Use the Selection Class, in the editor script, assuming it is a button that changes the currently selected object it is :

     if (GUILayout.Button("To the car"))
        {
            Selection.activeObject = GameObject.Find("SkyCar");
        }

Assuming that you have used the Selection Class, it should automatically highlights the gameobject and change the inspector window to the gameobject currently selected.