How to highlight or select an asset in project window from editor script?

Hi

Is there a function for highlighting assets in project window like when I click on a variable of a script in the Inspector? I'm making an Editor script.

Thanks

You could use Selection if you want to mark it in the Project

Selection.gameObjects = new GameObject[] { theGameObjectIwantToSelect };

Or if you want the object to highlight as yellow then you could use PingObject

EditorGUIUtility.PingObject( theObjectIwantToSelect );

Although the above answer seemed to work for many, I couldn’t select assets in my project window by following the answer above (only my hierarchy view). However, I managed to select assets by using the following command. Here is an example of selecting a prefab that resides in your Project window.

Selection.activeObject=AssetDatabase.LoadMainAssetAtPath("Assets/Prefabs/"+prefabName+".prefab");

Hope that helps someone!