How to get the file path of object assigned in inspector?

I want to get the path (directory) for an object dropped in the inspector.

I know Application.dataPath with return the path to the asset folder, but I want to get the path of the object even if it is nested in a folder.

I know one way to do it (get the Asset folder contents, and look for a match in every sub folder), but I was hoping for an easier way.

Any ideas?

Well I know of a way to do it with the UnityEditor namespace. Just check out the class AssetDatabase, it should contain a method for retrieving an objects path.

Thank you!

It looks like AssetDatabase.GetAssetPath is what I need.