Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4.9f1
2020.2
Issue ID
1277325
Regression
No
SpriteAtlasManager.atlasRequested event silently fails if the sprite is called upon before the event is triggered
How to reproduce:
1. Open tester-attached project (SpriteAtlasEvent.zip)
2. Open the SampleScene
3. Enter Play Mode - see that a warning is printed from atlasRequested event
4. Open the AddressableImage.cs script and uncomment line 24(Debug.Log inside OnValidate())
5. Enter Play Mode again
Expected result: a warning is printed from atlasRequested event
Actual result: no warning is printed from atlasRequested event
Reproducible with: 2018.4.27f1, 2019.4.10f1, 2020.1.6f1, 2020.2.0b3
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
- Render Graph Execution errors when using GPU occlusion culling with 'Opaque Objects' frame setting disabled on a Camera
- Animator window: “Delete” menu item not greyed out for Base Layer context menu
- Resetting “PC_RP Asset (Universal Render Pipeline Asset)” causes Game view to become black and throws Renderer and NullReference errors in the Console window
- [Mobile] Player Crash on scripting_invoke_profiler_begin when the built Player Scene has an empty UIDocument and is built on IL2CPP
- Unnecessary Warnings are logged when running Player with -batchmode -nographics
Resolution Note (2020.2.X):
Since OnValidate awakes the Sprite even before entering Playmode, the atlasRequested does not get registered by design. Also note OnValidate is only called in Editor mode.
Please modify OnValidate as follows :
protected void OnValidate()
{
#if UNITY_EDITOR
if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
Debug.Log(image.sprite);
#endif
}