Selection.activeObject doesn't return folders in Unity4

In Unity 3.5.x, I had editor scripts that relied on Selection.activeObject to return the selected folder.

This no longer works in Unity 4. Is there replacement functionality? To get the selected folder name in an editor script.

Any answer?

This has made editor scripts much less useful now that Unity has removed this functionality.

I just ran into this same issue and found it astounding that there had not been any answers. At any rate, the default view of the Project Hierarchy was changed from one column to two and apparently when you have it in 2 columns the Selection.activeObject does not function properly. So just click on the context menu dropdown icon the upper right hand corner of the of the Project Hierarchy view and select “One Column Layout”. Select your desired directory and try running your Editor script again. Hope that helps!

Sounds like a bug.

I have also met the same problem . Thanks cgross. I have solve the problem.

It does work in two-column layout, but only if you select the folder in the right panel. Selecting in the folder/hierarchy panel (left side) doesn’t.

I’m guessing this is for internal functionality differentiation, since you’ll notice that selecting a folder in the left panel shows nothing in the inspector, while selecting one in the right panel shows a [pointless] preview with the name of that folder.

But it tripped me up initially, since we have a number of editor scripts that rely on getting the selected folder.

Bump…

https://fogbugz.unity3d.com/default.asp?821390_7veupudqbv25417o