GetByXPathNote: You can change the default behavior of these attributes using Edit/Project Settings/SaintsField/Config
Please read Saints XPath-like Syntax section for more information.
Parameters
-
(Optional)
EXP config: config tweak -
string path...: resource searching paths.Using
$as a start to get a path from a callback/property/field. -
Allow multiple: Yes. With multiple decorators, all results from each decorator will be used.
Showcase:
// get the main camera from scene [GetByXPath("scene:://[@Tag = MainCamera]")] public Camera mainCamera; // only allow the user to pick from the target folder, which the `Hero` script returns `isAvaliable` as true [GetByXPath(EXP.JustPicker, "assets::/Art/Heros/*.prefab[@{GetComponent(Hero).isAvaliable}]")] public GameObject[] heroPrefabs; // get all prefabs under `Art/Heros` AND `Art/Monsters` [GetByXPath("assets::/Art/Heros/*.prefab")] [GetByXPath("assets::/Art/Monsters/*.prefab")] public GameObject[] entityPrefabs; // callback: auto find a resource depending on another resource public Sprite normalIcon; [GetByXPath("quot; + nameof(EditorGetFallbackXPath))] public Sprite alternativeIcon; public string EditorGetFallbackXPath() => normalIcon == null ? "" : quot;assets::/Alternative/{AssetDatabase.GetAssetPath(normalIcon)["Assets/".Length..]}";