Search Issue Tracker
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:
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:
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
-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.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Flickering orbs appear when using RenderTargetHandle
- UsePass for ShaderLabShader is ignored and GameObjects are not rendered when SRPBatcher is enabled
- Animated model translated down when interrupting a transition
- UI Toolkit text splits when changing PanelSettings scale
- Error "NullReferenceException" is thrown when selecting folders from the folder panel or closing the folder panel with EditorUtility.OpenFolderPanel() in use