Focus a file in Project Window


In an EditorWindow, I’d like to focus a file in my project window.

I’ve found EditorUtility.FocusProjectWindow but it only give the focus to Project Window, not the file.
I’d like to have the same behaviour as Object Picker’s one: when I click on an Object Picker, the selected object is focus in yellow.

Is somebody ever try?


EditorGUIUtility.PingObject is what you’re looking for. Pass in a GameObject and it’ll highlight it yellow in the project view :slight_smile:

Thanks for your quick reply.

It works well.

I tried it before but I have been stopped by the object parameter.
I finally get it with Resources.LoadAssetAtPath.

Thank you.