AssetDatabase.GetAssetPath is editor only, behaviour needs to be replicated @ runtime

I’m basically stuck on exporting levels. I have all my prefabs in the /Resources/ folder where they’re organised into folders to keep things clean. This works fine for basically everything I’m doing except when I want to export all the objects in the scene to a file. I need it to have the full /Resources/x/y/z path to the prefab, but the only function I found that resolves the path is an editor only function.

Does anyone have a solution to this?

Is it possible for you to create a “Filetable” file in edit time? You then can write all paths with some kind of unique id per prefab into this file and just ask the Filetable at runtime which path the given Id uses.

I just thought about adding a component with the name of the asset when it’s instantiated. I can just then getcomponent it later that way. Thanks anyway Marrrk.

Edit: Just ended up changing the name at runtime because it seems to be faster.