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
- Assigned font's bold/font-weight styles render using Default Font's assets when Default Font has corresponding style assets defined in TMP Settings
- "Modifying the parent of a VisualElement while it’s already being modified is not allowed" error is thrown when entering text and pressing tab in the Search window
- Mesh colliders are not updating their positions of bounds correctly
- Images are missing from the "Open the sprite editor" documentation for 6.0, 6.1 and 6.2
- The previous element in the array is modified when assigning an Asset to a new element of AssetReferenceT
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.