"add selected" editor script

I´d like to know if there´s a command to get the currently selected object(s) in the “hierarchy” tab within an editor script.

I´d like to be able to add these objects to an array in my editor script.

any suggestions? Thanks!


Use the Selection class. You can access all selected gameobject, all selected non-assets, all top level transforms or the one transform shown in the inspector.