Quiz Master - Weird TMP Display when opening project

Hi there. I’ve gone back to the start of the Quiz Master project as I had been away from it for a while and needed a refresher. I’ve just got to the TMP sections and I’ve encountered a weird bug where the TMP elements display oddly. Strangely enough, clicking on the Game tab, then clicking back to Scene seems to fix the issue, but I have no idea why it’s occurring in the first place. You can see the display problem in this image.

By the way, at the start of this project the lecturer changes the name of a scene, but I can’t work out how to do this in the Hierarchy. I tried to just Save As a new scene, but then Unity still opens the empty scene by default when opening the project.

Hi,

Have you already tried to adjust the anchors? Are the game objects with the TMP components parented to the Canvas game object?

The objects are parented, yes. The Button Group array I added in the next lecture also looks odd. All of these objects are anchored to the centre by default. Maybe it’s purely a visual bug on loading Unity because as I said, clicking the Game view once then clicking back to Scene makes it display correctly. Weirdly on my original version of this project that I made a couple of months ago this bug is not occurring, but I can’t see any differences in the individual objects that might suggest why the display is odd. Could it be because I deleted the original Scene so that it would default to loading the Game Scene I created (because I couldn’t see how to rename the scene without making a new one).

Which version of Unity do you use? If you click the game view and the TMP objects suddenly get displayed correctly, there might be a bug in Unity.

Could you please share more screenshots of what you did in Unity? I’m interested in the Canvas and the Inspector of the Buttons (the parent, the Button children are irrelevant) or the Question Text or title.

In the Game Window, what resolution did you select? Ideally, set it to 800x600, not Free Aspect or an aspect ratio because, otherwise, if you change the size of the game window, the canvas box might shrink.

The Game Window resolution is set to 1920x1080, as specified in the lectures. 800x600 is not an option in the resolution list.

Unity editor version is 2021.3.0f1

Here are screenshots of the Quiz Canvas and the Button Group Parent.


Please let me know if you need to know anything else. I’m pretty ignorant when it comes to this kind of thing (but trying to learn).

The screenshots were helpful. Thanks. :slight_smile:

I think that the issue might be in the AnswerButtonGroup game object. See here:

image

Unless you have got a giant screen, 1200 is way too wide for the buttons. The height is fine, though.

Do you happen to use a second screen on which you display your game window?

And could you share a screenshot of the game window including its top menu bar?


800x600 is not an option in the resolution list.

You can add it. The should be a button with a plus icon or something like that in the dropdown menu where you selected 1920x1080.

Hi again. Sorry for the late response - I haven’t had time to get back to the course for a few days.

As I said before, the course tells you to set the resolution to 1920x1080. The lecture (lecture 54) also has the width of the button group exactly the same as I do. Besides, it’s not only the button group that is displaying oddly, and it’s only when I first open the project to the scene window - one click into the Game window and then back and it’s fine. So maybe it’s just a temporary visual bug in this version of Unity. Also, the previous version of this project I started working on does not have any of these issues and all the settings/sizes are the same from what I can see.

I have a second screen, but I don’t use it for the Game window - I always have a browser open with the course on one screen while working in unity on the other.

Here is a screenshot of my Game window.

Based on what you wrote, that might well be the case. The position of the UI elements is relative to the anchors. Unity has to calculate these things. It might be that you force Unity to recalculate them if you switch the window and get back.

I found this bug in the release notes of your Unity version. Maybe it is related to your problem.

Unity 2021.3.4f1 is the latest version of Unity 2021. If you have time, you could install either Unity 2021.3.4f1 or 2022.1.5. Duplicate your project folder. Open the duplicate in the new Unity version. This way you will not risk breaking your project if you decide to stick with 2021.3.4f1 for your actual project.

Hi again.

I installed the latest version of Unity, and opened the project in that. Initially the same visual bug occurred, though this time it was also present in the Game window. However, I noticed that the resolution had been changed to Free Aspect. I changed it to 1920x1080, switched back to the Scene window, saved the project, then opened it again. This time, it displayed correctly. So maybe for whatever reason in the earlier version, the Scene window was temporarily defaulting to Free Aspect.

In any case, thank you for your patience while looking into this issue. I’m eager to get back on course without worrying about ongoing problems.

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