How do I detect when X is selected in the Hierarchy and the Project windows for a custom Editor?

I want to create an editor window that has a similar behaviour to the Animator window (like when you select a controller in the project window or select an animator in the hierarchy window, it updates the Animator editor window).

I’ll have a specific file type that when selected in the project will display my data visualization. Is there some sort of type/asset selection event registration?

My google-fu is seriously failing me. It keep offering suggestions that aren’t related to things I’m interested in. The problem is that I don’t know the right words to ask google an intelligent question.

Any direction would be amazing and appreciated

Hey there,

Anytime something is selected you have access to it.

Selection.activeObject

You can check that object for the type you are looking for and update the inspector to reflect this.

Cheers,

So you have to poll for selection then? In the Editor update loop?