Day 75 — Setting up the 2.5D Project
Hey and welcome!
I’ve got a nice short one for you here where I go over the setup for this 2.5D game we’ll be working on.
First things first, create a new Unity project as usual and choose the 3D template.
Creating the Level
Next we’re going to set up our level with a few platforms so that the player we add in will have something to jump between. Right click in the hierarchy and create a 3D cube object making sure that its position is 0x 0y 0z and then click on your x angle in the scene view so that you’ll be looking at your scene from a 2D perspective. You’ll want to make sure that the red for the x axis is on the right and that the green for the y axis is on top so that you have the same view as the main camera.
Now scale out the x of the transform for the cube to about 4.5 to give it a rectangular platform looking shape and then create a prefabs folder to stick this in.
Duplicate these platforms so that you have about 6 of them in your scene with varying heights and distances between them, this isn’t really a mandatory step so you can go wild here if you wish or if you already have a game with ground to walk on then you can skip this part too.
Creating the Player and Coin Pickup
It’s time now to create a player object along with something that the player can pick up. Nothing too fancy going here and you can swap out the suggestions for anything you prefer, for me though I’m going to create a cylinder object and call it Player and stick it on the first platform.
The placeholder I’m using for coins are going to be sphere objects so create a new sphere in the hierarchy and place a few of those around your level. Set the trigger to true in its collider and then add a rigidbody component with the gravity off.
When you’re placing all these objects make sure that the z access for everything you add in is set to 0, this keeps everything on the same plane and stops any object falling out of the world. If you create any empty objects to group up other objects make sure that the position for that is set to 0x 0y 0z otherwise you’ll get similar issues!
That’s everything here, we’ll look into creating a character controller for the player so that we can move it about and add our own gravity.