How do I list subassets in scripts?

Is there any way to list subassets in a main asset without loading all subassets?

I can load all subassets using AssetDatabase.LoadAllAssetsAtPath() but that might be too slow. I just want to get the names of all subassets in a given asset to generate an unique name for a new subasset. Do anyone have better ideas?

Unity doesn’t really have a concept for “subasset”. Are you talking about a GameObject that is the child of another GameObject?

Thank you for your reply.

No. They do have functions called AssetDatabase.IsSubAsset and AssetDatabase.IsMainAsset. You might try AssetDatabase.AddObjectToAsset, and you would know what I meant.