AssetList attribute with Path parameter issue

Issue #108 resolved
Jérémy GUERY
created an issue

Hello,

I have an issue when I use the AssetList attribute with a Path parameter. I want to search assets that contains a component in the folder: "Assets/Entities".

So I use the attribute AssetList:

[SerializeField, AssetsOnly, AssetList(Path = "/Assets/Entities", CustomFilterMethod = "HasHUDContainer")]
private GameObject prefabHudInUi = null;

private bool HasHUDContainer(GameObject gameObject) {
    return gameObject.GetComponent<HUDContainer>() != null;
}

The inspector display "Prefab Hud In Ui //Entities 0 items". The "Assets" folder seems to be strip.

I can use this workaround to solve the issue:

[SerializeField, AssetsOnly, AssetList(Path = "/AssetsAssets/Entities", CustomFilterMethod = "HasHUDContainer")]

The inspector and the search work great!

Comments (3)

  1. Bjarke Elias Clauson-Kaas Ørrild

    Hi Jérémy,

    I assume you have a folder names Assets within the project root folder which is also named Assets?

    This is sort of a weird case because, in theory, all paths specified should start with "Assets/" but that would be kind of annoying. So it is currently prepended to it, but only if it isn't already there. I've changed this so that it now always prepend "Assets/" to the path regardless of whether it starts with it or not.

    The UI issue is fixed as well. I'll send you a build later today :)

  2. Jérémy GUERY reporter

    Yes I have a folder names Assets in the Assets directory.

    You are right this syntax works too :

    [SerializeField, AssetsOnly, AssetList(Path = "Assets/Assets/Entities", CustomFilterMethod = "HasHUDContainer")]
    

    The inspector display "//Assets/Entities". No hurry for the custom build :) I can wait the next patch. Thanks

  3. Log in to comment