UI elements different in the scene view than in game view?

I have this issue pretty consistently, where I will construct some UI element in the scene view and it looks right, but when I look at it in the game view something is different. Often, no matter what I change, the element that is different will not change at all. For example, today I set up a button and it looks normal in the scene view, but in the game view it looks tiny. When I adjust the sizing of it in the scene, it continues to look tiny and unchanged in the game view. I’ve also had other weird issues like this. For example, text being displayed vertically while it it horizontal in the scene view, or an image using an entirely different sprite. Anyone else get weird behaviour like this?

Hi,

Unfortunately, I do not understand your problem. What did you expect to happen? What happened instead? Could you please share screenshots of what you see in Unity?

The game window is a preview, which does not have much to do with your final build. There is a scale slider in the top horizontal menu bar.

If the UI elements appear at the wrong position in the game window, take a look at the manual. Maybe the anchors are not set correctly.

https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html

Here are some images to illustrate. In the first two, you can see that the response text is being displayed wrong in the game view, and the Speaker’s Name is not aligned correctly.


gameview

In these two, you can see that the bg image is wrong, and the Next button has been resized. No matter what I do in the scene view, the Next button will not change size in the game view.
sceneview2

In each case, the target resolution is the same, the reference resolution is the same, the game view is set to 1920x1080, and the scale to 1. I’ve worked with UI before so I do understand how the scaling issues work. But these weird issues where the game view/build do not reflect what is in the scene view is new to me.

In which course and lecture are you? This does not look like something from the courses for which I am providing support (Unity 2D and 3D, but not the RPG courses). If this is from one of our courses, I’d like to add a tag to your thread so the responsible teaching assistent will be able to find your thread.

I’m in the 3rd part of the RPG course, Quests & Dialogue. But this question really isn’t related to the course content specifically, I’ve had similar things happen to me in other unrelated Unity projects.

This is, unfortunately, something that drives even Sam and I crazy. UI can be very fussy to work with.

I always recommend when working with UI to turn the Auto Save off in the Prefab, and to commit your existing project in source control before beginning to edit UI.

It looks like the Content Size Fitter in the Vertical Layout Group for the player responses isn’t quite right. Post up a screen shot of the Vertical Layout GameObject’s inspector (be sure the Vertical Layout Group and Content Size fitter are expanded) and I’ll see if I can spot anything obvious.

For the button sizes, remember that with a reference resolution of 1920x1080, it’s unlikely that you’re actually viewing the game at that resolution (unless it’s set to maximize window). This can make things look strange. That being said, you should be able to look at the scene in Game View when the game is not running and see the UI and how it should appear.

Yeah, this is the weird thing. It’s in a maximized window, but it actually doesn’t make a difference. That button doesn’t change size in the game view no matter what I do. I can make the window 1/10th the size, set it to free aspect, it makes no difference.

As for the player responses being vertical, I fixed that by deleting them and starting over. Ultimately, I didn’t come here to ask about any specific issue, it was more to try to find out what is going on with Unity’s UI in general because I encounter something like this almost every time I do UI work.

Unfortunately, I go through this all the time with UI. I do a lot of deleting and rebuilding with my UI. I wish I had better answers on that front. One of the many reasons I urge good use of source control.