2
\$\begingroup\$

I'm a brand new unity developer and I watched a few tutorials and then found a game on the Asset Store to provide a nice base for my game. However the setup, especially with multiple scenes is quite different than the tutorials I watched and I can't figure out what is happening. Here is my Scene view from the main menu:

enter image description here

When I click on Main Camera the tiny little thing with the green outline in the corner is highlighted.

Now if I click play, that whole menu fits in the screen, even though the Main Camera is apparently tiny? Then, while playing, I click back to scene view I see this:

enter image description here

It shows the camera as being empty, even though in Game View I can see/interact with the menu.

When I swap to my Scene 1, which is the game view, it is the exact opposite. This is what I see in Scene View while the game is playing:

enter image description here

Note the game running in the preview in the corner. Those tiny circles are the same circles on the main menu, how does the same asset fit in what appears to be two wildly different sizes?

So I ask, what is the different between the two scenes. One appears in the preview while one doesn't. One fills in the huge canvas while the other apparently fits in the tiny camera. What am I missing?

\$\endgroup\$
4
\$\begingroup\$

This is the difference between the UI and the in world objects. Your main menu is a screen space UI, the rest of your objects are in world objects, likely sprites.

The reason they're vastly different sizes is just how the editor displays their size. The main menu (UI) has its size based on pixels. Maybe something like 1080x1920. The world objects have their size based on world units. Probably something like 1 unit across for those little circles (wild guess, impossible to tell with the information provided).

Now, in game, these will both look just fine. In the editor, it's going to display the UI using the UI size, except it's going to interpret those values as world units. In other words, it's going to convert pixel units into world units. That means your UI, which is 1080 pixels across, is now going to be 1080 world units across. That's more than 1000x bigger than your game objects.

So, what to do about it? You can change the scale of your main menu. This won't affect the on screen size, but it will change the in editor size. So, for example you could scale your main menu to .0075 on the X, Y and Z axes. It'll still be the same size in pixels, but will be scaled in the editor to be closer to the same size as your in world objects.

\$\endgroup\$
  • \$\begingroup\$ That makes a lot of sense to me! I'm having trouble figuring out where to scale it as you say in you last paragraph though. When in the Menu scene I can select MainMenuManager, Main Camera, Canvas, I thought Canvas makes sense because that highlights the big rectangle but the only enables scale is "canvas scaler" and the resizes all elements in it not the box, and does affect in game size. \$\endgroup\$ – DasBeasto Feb 10 '17 at 20:45
  • \$\begingroup\$ Yeah, the Canvas is what you want. You can manually scale the canvas in the Transform property (You might have to remove the canvas scaler, I don't remember off-hand). But really, it's not important to scale it. As you know, it works as expected in game, it's just the editor that's a little wonky. Just double click an item in the Inspector to focus the editor camera on it if you're getting tired of zooming in and out. \$\endgroup\$ – MichaelHouse Feb 10 '17 at 20:49
  • \$\begingroup\$ Yeah I suppose I'll just leave it as is if this is the norm. My last app just got really messy and overwhelming (different language) so I want to do this one the "right way". Thanks! \$\endgroup\$ – DasBeasto Feb 10 '17 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.