Search Issue Tracker
Fixed in 2019.2.X
Fixed in 2019.1.X
Votes
0
Found in
2019.1.0a4
2019.1.0a13
Issue ID
1114240
Regression
Yes
[UI] Image component breaks when the sprite is replaced
Multiple bugs occur once a Sprite is replaced for Image component
1. On deleting the sprite Destroy Error occurs
2. Sprite is no longer being scaled
3. Artifacts appear when Simple Image is replaced by Sliced Image and undo is pressed
Steps to Repro:
1. Open attached project
2. Open Sample Scene
3. Select "Image" GameObject in Hierarchy window
3. Replace Source Image Sprite to "Card Frame_Sliced" from Inspector
4. Press Ctrl+Z (Undo)
Actual Result:
1. Sprite is not restored back to earlier used sprite, however, Image Type is changed to normal
2. Artifacts appear
Expected Result:
1. Sprite is restored to earlier assigned sprite, with Image type set to normal
2. The Image should be scaled according to Rect Transform Width and Height
3. 1. Image GameObject Should be deleted gracefully
Environment:
Windows and Mac
Occurring with:
2019.1.0a13, 2019.1.0a5
Working with:
2019.1.0a4, 2018.3.0f2
Stack Trace:
Destroy may not be called from edit mode! Use DestroyImmediate instead.Also think twice if you really want to destroy something in edit mode. Since this will destroy objects permanently.UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
shubhamswaraj2021
Aug 18, 2020 16:44
good one <a href="https://www.lyricsauto.com">lyricsauto</a>
boorch
May 24, 2019 11:47
Hi!
After upgrading my project from 2018.3 to 2019.1 I also encountered this problem.
I tried using image.overrideSprite = newSprite instead of image.sprite and that seems to work as a temporary solution. I've only tested in Editor btw, I will update this comment whenever I have the chance to test this on mobile and desktop builds.
BasicallyGames
May 17, 2019 21:11
I'm having this issue still. Using Unity 2019.1.2f1. Happens during runtime when I change the sprite of any image on my hud.
Maulwurfmann
May 07, 2019 09:46
This is still a issue in 2019.1.1f1. Hope this will get fixed soon!
Marco2000Unity
Apr 23, 2019 21:57
Bug 2 is not fixed in 2019.1.0f2
Why do they say it is fixed in 2019.2 if there isn't any 2019.2 official releases?
There is just the alpha release...
wowipop
Apr 18, 2019 03:47
Bug 2 not fixed. tested on 2019.1.0f2
Chipinators
Apr 17, 2019 14:36
Bug "2. Sprite is no longer being scaled" is still not fixed
Tested in 2019.1.0f2 and 2019.2.0a11
Steps to Reproduce:
1. Create Image object
2. Set a default sprite and enable perserveAspect on the Image component.
3. During runtime via script change the Image's sprite to a sprite of a different aspect ratio (Image.sprite = newSprite)
Expected Result:
1. The new sprite should be scaled up to fit the rect component while keeping its aspect ratio
Actual Result:
1. The new sprite is stretched to fit the entire rect component
AcidSheep
Mar 15, 2019 12:12
Hi.
Will this be fixed for 2019.1 as well?
I don't want to switch to an Alpha Release right now...