About 'World Units & Play Space'!


#1

In this video (objectives)…

  1. Discuss what Unity World Units are.
  2. Set up our camera size.
  3. Import and set up background image, paddle, ball and block.

After watching (learning outcomes)… Understand world units and set up play space.

(Unique Video Reference: 4_BR_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!


#2

Hi Rick! Loving the course, thanks for making this fun!

My canvas is a bit weird in this lecture! I’ve uploaded a screenshot – I’m having a bit of trouble with getting the canvas size right.

How do I make the canvas the same size as yours?

Here are your canvas settings (as screenshoted from the previous lecture):

Also, I’ve uploaded my zipped code here if that helps too:

Block Breaker.zip (8.5 MB)

Thanks Rick!
Blaine


#3

Hey Blaine,

Your canvas usually wont match the size of your game’s play space and this is fine. Usually the canvas is huge compared with the actual game… but the relative sizes dont matter given that the canvas will be presented in relation to the camera / screen (ie. it fills the screen no matter what size your game assets are).

When clicking on canvas, you’ll see a component further down called Canvas Scaler. We are using a 4:3 aspect ratio in our game, but it looks like you are using 1920x1080 which is a 16:9 resolution. If you change your reference resolution to 1440x1080, that might help. You might want to watch the set up video to double check your settings are the same as mine.

Hope this helps.


#4

Same problem here. If I just drag my background to the scene it is presented in a very small size there. In the Game window the background is gigantic, pixelated and in the wrong position.

The only way to add this stuff and have a proper size is adding a image to the canvas and use PNG asset files as Source Image.

I tried the drag option a second time and now is ok at the Game window (camera), but is still very small at Scene Editor window. Well, at the Game window is ok because I move the pivot point back to the center of the BG image. With the pivot point at the left bottom corner, the image appears with its left bottom corner at the center of the camera view.


#5

[SUGGESTION]

I understand now what was confusing me.
In the previous lectures Rick always worked in the Canvas, and now he is working in Camera.
I think that is important to address this change in the video. Is important to explain why Unity has this two different things (Canvas and Camera) and why they have different sizes/scales.

I never saw a software with this kind of setup, this is why I was so confuse. Why Unity has this two things, in different sizes and scales, that will be mixed together in the final App? Makes no sense to me.


#6

Yep, I understand what you’re talking about. I’ll have a look to see how I can make this more explicit. I thought we covered the canvas / camera difference in previous sections, I’ll investigate.


#7

Thanks Rick and Fernando!

I figured it out over time and I agree with Fernando; it might be worth pointing out again that canvas != camera, and that it’s A-OK for those 2 to be completely different.

I still don’t understand why the camera/crationspace and canvas become the same size when I hit play / go into game mode, but I do know that it works every time, so I’ve stopped worrying about it.

Brilliant course and I’m so glad I signed up!
Best,
Blaine


#8

Hello everyone this is my play space

While the background I found it on the web the paddle, the ball and the bricks are all made by me.

Hope you like it :grinning:


#9

Hey Rick, thanks for the awesome videos. Your way of teaching is really fun and entertaining. My doubt is that in this video, we are dragging an image into our project folder and then on to the camera, so that it automatically creates a game object. Is it possible to create a new game object and then use Unity’s UI image, to somehow convert it into a sprite and then assign it to the sprite renderer of the game object? Or is this the only way?


#10

Hi there, yep its totally possible to do this other ways - and by the end of the course you’ll be a pro at creating game objects!

Just to be clear, we are dragging the asset into our project folder to save it as an asset that can be used in our project. Then we drag it to the hierarchy which creates a new Game Object with the required components to render the sprite. If you wanted to do this differently you could create your own Empty Game Object (right click while in hierarchy and select the option) then add a Sprite Renderer component on the Game Object and then assign the image in the Sprite Renderer. If this doesn’t make sense, no problem, we cover this in upcoming sections.


#11

Thank you so much for the quick reply Rick :slight_smile:


#12

Here is my background, the lower left rectangle is my paddle atm, the one from your assets didn’t seem to fit with my theme. I’ll be designing one later in Inkscape I think.


#13

I am running into this too. Where did we set up a 3x4 aspect ratio? Is it in the setting for the camera but using the equivalent fraction 1440 x 1080, or is it at a higher level like in preferences for project setup?


#14

We’ve set it up right here:
aspect_ratio

You can set it to 16:9 or 3:2 and you’ll notice that your camera also changes its aspect ratio in the scene view (and so does the canvas btw, they both try to fit the aspect ratio you set there).


#15

Main Camera is not pointing the right way, and it is parented to the canvass, and the background in a weird way, so that I can’t seem to break it. As a result, all that the camera is seeing is a blue field. By switching to 3D view I can see that All I need to do is to move the camera to the other side of the background. But they are locked together. Whenever I move one the other moves as well. Grrrr.

I have tried fiddling with the hierarchy, but I cannot seem to break their parental bond. One is always the parent of the other, and they always move together.


#16

If you have the camera parented to your canvas, then just drag it out of there (be careful not to drag it onto another game object) so the camera is on its own and has no child objects in it:
hierarchy
(UI is my canvas)

Make sure that your camera’s Z is at -10 and that all your sprites in the world are at Z 0.


#18

Hey Rick,

I have a problem with my “Rocket blue sky background” Sprite: After I changed the pivot to bottom left, the gizmo is still at the center of the background image when I click on the Move tool. So the Sprite pivot and Transform gizmo are at different positions on my scene. What could be the problem at me?


In 3D view:


#19

Very cool! This could contrast Rick’s idea of a frantic player experience with more of a zen one, making the ball go slower and maybe give it some calming sound effects. It could become one of those games people kind of zone out playing, very cool!


#20

I think that this is okay, and it is in my screen too. The Pivot Point just denotes where Unity considers the “center” of your image, or where it starts when figuring out your transform. The gizmo is just a tool for you to be able to move it, and I think it just shows up in the center of all items.
Anyone, feel free to correct me if I’m wrong, but I think you should be good @barbara88.


#21

I love this! Did you do the graphics yourself? If so this is a really cool theme, and not one I’ve seen in this Breakout genre. You could even do the blocks as types of coral or other shells.