Search Issue Tracker
Fixed
Fixed in 1.22.3, 2.3.7
Votes
9
Found in [Package]
2.2.2
Issue ID
ADDR-3784
Regression
Yes
Exception "IndexOutOfRangeException" is thrown when assigning an addressable SpriteAtlas to an AssetReferenceSprite field
Reproduction steps:
1. Open the attached “BugRepro” project
2. Select the “DeclaringReferencesTest” Asset in the Project window
3. (Optional) If the Inspector window is empty, make sure to Reset the Asset
4. Set a new value for the “Sprite Reference” option
5. Set a new value for the “Subasset” option
6. Observe the Console window
Expected result: No errors are thrown
Actual result: Error “IndexOutOfRangeException: Index was outside the bounds of the array.” is thrown
Reproducible with: 2.0.3 (2023.2.20f1), 2.2.2 (6000.0.22f1)
Not reproducible with: 1.22.2 (2021.3.44f1, 2022.3.50f1)
Reproducible on: Windows 10, Windows 11 (user)
Not reproducible on: No other environment tested
Comments (1)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Play Mode Scenario selection/highlight is too long and out of its bounds when the Play Mode Scenario window is opened after maximizing
- Duplicated groups and incorrect grouping in UI Builder when using UxmlElementAttribute: libraryPath
- Asset name is not shown in the Undo History window when a sprite is modified
- Moving a Tab to a floating window fails when floating windows are docked next to each other
- Crash on UNITY_FT_Render_Glyph_Internal when Generating Font Atlas in the Font Asset Creator Window
VodaLechebna
Dec 14, 2024 12:27
Still an issue in 6000.0.31f1 and all Addressables package versions available there. So let's fix it by modifying some files in YourProject/Library/PackageCache/com.unity.addressables:
In Runtime/Utility/AssetReferenceUtilities replace lines 28-31 with:
```cs
for (int i = 0; i < sprites.Length; i++)
{
packables.Add((sprites[i], sprites[i]));
}
```
In Editor/Settings/AssetReferenceDrawerUtilities insert this code right at the start of foreach at line 507:
```cs
if (string.IsNullOrEmpty(assetReference.SubObjectGUID) && FormatName(sprite.name) == assetReference.SubObjectName)
{
foundSubObject = true;
break;
}
```
This will fix it.