Changing UI Image's sprite, preserve aspect ratio is checked but not working. Version: Unity 2019.1.0f2
I updated to the latest software update for Unity which is Unity 2019.1.0f2.
Before when it was version 2018.3.12f, the UI Image's sprite changes normally. But now when I have updated it, it doesn't regain its aspect ratio and gets stretched.
When the sprite changes on the UI image, the aspect ratio/width and height changes for the image and when you go back to the original image, then it becomes stretched or compressed.
I thought it was because I updated my game Unity version but I reproduced it on a brand new Unity project and it is doing the exact same thing.
How I reproduced it:
Code in Sprite and Image.
Code to change the sprite image to the next image in the sprite array.
Have a button to cycle through the images.
Press button multiple times.
When it is cycled back to the first image again, it is now stretched or compressed and aspect ratio doesn't go back to its original size.
This bug has only been happening when I updated to the latest version Unity 2019.1.0f2 from 2018.3.12f.
Help would be appreciated. Thanks!