Search Issue Tracker

Fixed

Votes

0

Found in

2020.3.42f1

Issue ID

UUM-20571

Regression

Yes

AssetDatabase.FindAssets behaviour is bugged when using filters as of 2021.3.14

--

-

Steps to reproduce:
1. Download the attached user's project "UnityBugFindAssets.zip"
2. Open the project in 2021.3.13f1
3. Select the menu item "TestSelect/select"
4. In the Console Window log you shall see the following:

"Assets/Triangle/TriangleTexture.png
Assets/Square/SquareTexture.png
Assets/Circle/CircleTexture.png"

5. Close the project and reopen it in 2021.3.14f1 and repeat step 3
6. In the Console Window log you shall see the following:

"Assets/Triangle/TriangleTexture.png
Assets/Square/SquareAnimation.anim
Assets/Square/SquareTexture.png
Assets/Circle/CircleMaterial.mat
Assets/Circle/CircleTexture.png"

Expected results: Only the texture files shall be returned and printed to the console, as per the Texture2D filter added to the FindAssets call in TestSelect.cs
Actual results: 2021.3.14f1 only sees the expected results with the first path in the array, returning TriangleTexture.png. However, subsequent paths return all assets and not just the textures. For example, Assets/Square returns both "SquareAnimation.anim" and "SquareTexture.png" despite the Texture2D filter being present in the FindAssets call in TestSelect.cs

Reproducible on: 2020.3.42f1, 2021.3.14f1, 2022.1.22f1, 2022.2.0b14,
Not reproducible on: 2020.3.41f1, 2021.3.13f1, 2022.1.21f1, 2022.2.0b13, 2023.1.0a21

Notes:
-When AssetDatabase.FindAssets is used with a filter and an array of paths to be searched, it typically looks through the path and returns only the assets that are present in those paths based on the filter. However, as of 2021.3.14 when using a Texture2D filter with an array of multiple paths, only the first path to search seems to respect the filters presence. All subsequent paths in the search array shall return all assets in that path, regardless of their type.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.