- Home /
Aspect Ratio Fitter is not keeping the aspect ratio of a vertical image
I am trying to have the player be able to choose any image from their PC and input it onto a UI Image. But to make sure that it is the right size, I wanted to make it have an Aspect Ratio Fitter to keep it from being too big and stay proportional. But if the width is smaller than the height, it sets the aspect ratio to 0, rendering the image to be invisible. My aspect mode is set to Fit In Parent. Also, any other image works fine, as long as the width is bigger than the height. Thanks in advance!
I never had any problem with vertical images and Aspect Ratio Fitter. Can you edit your question and provide your current code?
Never$$anonymous$$d! I figured it out. Thank you for your time!
Answer by Cryptonyte · Aug 21, 2018 at 08:44 PM
I found the answer. Apparently, when you divide two integers, you will get an integer answer, even if you want it to be a float. To fix this, you can write (float) before the variables you are going to use.
Your answer
Follow this Question
Related Questions
Raycast has offset when build is not in native aspect ratio 1 Answer
will my game fit the size of the screen of any device that uses it? 1 Answer
Resolution 2 Answers
Getting the right sprite texel to screen pixle ratio with iphone 6 as base resolution. 0 Answers
How do you scale text based on the number of characters? 1 Answer