What is the best way of getting the system path of a GameObject?

Hi, I’m looking for an efficient way to getting the system path of each GameObject in an array of GameObjects and returning them as a string.

I’ve been looking into AssetDatabase.GetAssetPath, but it doesn’t seem to return a valid string.


Is there another, more efficient way to get the system path. And how might I get the above AssetDatabase to return a valid string?

AssetDatabase.GetAssetPath will return a valid path if the thing you pass is actually a project prefab. You cannot get the path of a scene object (it doesn’t have one).

Thanks, that clears up a lot :slight_smile: