Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
One of the most exciting new developments in Unity 4.3 is the new 2D engine. It's a 2D game engine inside Unity, and it works just the same as the 3D except you're missing your z axis. You get all the physics you expect. The scripting still ties in. And everything works, well, exactly like the 3D world except you're working flat, and this is fantastic if you're developing mobile games, or casual games, for example. There's a couple of ways to get going with 2D, and it integrates wonderfully with the 3D if you'd like.
You can do a 2D mini game or overlay 2D in the 3D. You can also start out a project natively in 2D using a new template, and I'll show what that looks like before I bring some 2D into my 3D game here. If you choose File and New Project, you can create a new project with setup defaults for 2D. When you do this, you have the same options as usual. Are we bringing in a character controller, cookies, scripts, and so on? I'll start out by bringing in my character controller, and then also adding in my physic materials, and standard assets and scripts.
I'll browse to set my project and then get going in 2D. I've selected a folder, and keep in mind that I'm showing this as a possibility. Because we've already set up the project here for 3D, we're going to bring the 2D in. But I wanted to take a minute and show the new 2D defaults. When we start out in a new 2D project, the scene view is configured to be 2D. And we can toggle that off and of with the 2D button at the top of the scene view.
What's actually going on here is that the main camera is defaulted to the projection as orthographic and we can see it here in the camera, where we switch back and forth. Usually in the 3D game, we use a perspective, but now it's set as orthographic and ready for a 2D game. When we import assets, there's also a new asset type, and I'll bring a piece in just to show what it looks like. In the 1201 Assets Textures folder, I've placed a couple of assets we're going to use in that game. I'll bring in this cars 2D and click Import. What happens is that in a 2D preset, the default texture type is set to sprite, and we've got sprite modes and places to set the pivots.
It's defining the sprites based on the alpha channel of this image. And I've brought in a PSD here, natively. And that way, I'm going to work uncompressed for the best quality. For sprites then, we'll put the format as True Color, and I'm going to max out the size as it was drawn at 2048. I'll click Apply, and then I can go into Edit the Sprites. What I'm going to do though, is I'm going to go back into my 3D gallery project and bring in the sprites there, because what I'd like to have happen is this is a modern painting that will go on the wall.
And it'll appear to be flat until the player triggers an animation, causing the cars to zoom by and smash into each other. Keep in mind though that if you're working exclusively in 2D, you can start out a new 2D project and set everything up to be well, flat. But you'll be able to take advantage of all the physics and scripting from Unity you already know, just apply it in 2D.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 34078 Viewers
94 Video lessons · 23788 Viewers
100 Video lessons · 4269 Viewers
83 Video lessons · 9306 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.