Get 'SerializedProperty' value path

Hi ladies and gentlemen,

The custom editor above saves and loads data to/from one file. Background and Atlas are of type Sprite and I want to get their paths.
I searched serializedProperty for path/ value/ field or anything similar but found nothing.

Get their path?

Which path…

#1
The path of the SerializedProperty relative to the SerializedObject for that script?

Use this SerializedProperty.propertyPath:

#2
The path of the actual Sprites (‘bg’ and ‘9RPGenemies’ in your case), like as where it’s located in the ‘Assets’ folder on disk?

Use the AssetDatabase, probably want the GetAssetPath method:

1 Like