Search Issue Tracker

Fixed in 2019.2

Fixed in 2019.1

Votes

0

Found in

2019.1.0a4

2019.1.0a13

Issue ID

1114240

Regression

Yes

[UI] Image component breaks when the sprite is replaced

uGUI

-

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)

Comments (7)

  1. 36111055cae6ac3e14aaa65e27c1f1c7?d=mm

    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.

  2. C700b6a3b978ccf5fb29fac55383c409?d=mm

    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.

  3. 55ec6bb515359be7fd231666c299cbd1?d=mm

    Maulwurfmann

    May 07, 2019 09:46

    This is still a issue in 2019.1.1f1. Hope this will get fixed soon!

  4. 5354bb3a1681710547fbdf354d26b704?d=mm

    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...

  5. 2f0cd3da5689e689c9bb477b8eb9bb41?d=mm

    wowipop

    Apr 18, 2019 03:47

    Bug 2 not fixed. tested on 2019.1.0f2

  6. 0b94b716c52e7ac7cbbd3f866d524e9a?d=mm

    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

  7. Dc62b0c7357ee17561d8140d1c9b205b?d=mm

    Snowey89

    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...

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.