Quiz Game - Slider

Hello!

I’m making the slider for the quiz game currently. In following along with the video, I dragged the neon square sprite into the Background of the slider, in the Source Image box of the inspector. But when I did that, it made a much tighter / smaller oval rather than the nice rounded rectangle in the video. I’m not sure why that is. The shape worked fine when I made the buttons, so I’m not sure why it’s having issues here. It looks fine with the default Background image the slider comes with, but once I change its image, it shrinks down a lot. Any ideas? Weird stuff is happening with the Fill too. Pic below.

Hi Jonathan,

Click on the “broken” sprite in your Assets folder, then on “Edit Sprite” in the Inspector. Then slice that sprite as instructed in the manual: Unity - Manual: 9-slicing Sprites

Did this help you fix the issue?


See also:

It looks like the only thing on the list I hadn’t done was change the Mesh Type to Full Rect. But that still didn’t fix the issue. I tried making the 9-points a bit tighter to the border, and it didn’t help and messed with the answer buttons sprites to be wonky. It’s so odd! It’s like the Slider specifically won’t handle the sprite, rather than the sprite being the issue. Idk!

Set the Image type in the component (see your screenshot) to something else, then back to “Sliced”. Or try to remove the component and readd it. Sometimes, the components are a bit buggy.

Check the slider’s scale is set to 1,1,1 it may be causing the distortion.
Change the size of the slider using width and height.

Oddly still not fixed! For some reason, mine just doesn’t look as good as the instructor’s. The sprite works just fine for the buttons, but not the slider. Played with height/width. Removed/readded the Image component. Tried un-slicing/re-slicing. Made sure the slider’s scale was 1,1,1. Nothing. So odd.

Which version of Unity do you use?

Have you tried to set the Image Type in the component from “Slided” to something else and back to “Sliced”?

Also try that in the Import Settings. And if nothing helped, delete the slider and recreate it in your Hierarchy, then assign the image to it again. Sometimes, Unity components are a bit buggy.

And if that didn’t help either, please share screenshots of the Inspector of the broken slider as well as a screenshot of the Import Settings of the sprite and a screenshot of the sliced sprite (see Edit Sprite).

Are there any error messages in your console?

Hi Jonathan,

I had the same problem as you had. I looked into it and for me the following solution fixed it.

In your hierarchy fold open the slider and select the “Fill” object. In the inspector go to “Image”. Over there you see the “Pixel per unit multiplier”. I changed that value to 4 and the image showed exactly the same as the background object.

Hope this also solves your problem.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms