- Install Unity and SketchUp. They're free and awesome, so you should already have them because you are also awesome.
get things ready in Unity
- Good job. Let's open up Unity and start a new project. Give it an awe-inspiring name that sets people's expectations just a little too high.
- There's four key panels to look at when you open Unity. Their names are on little tabs at the top of each box in the display:
- The Scene panel shows you the 3D space the game will take place in.
- The Hierarchy panel shows you all the objects in the scene: cameras, lights, models.
- The Project panel shows you all the files you have saved in your main project folder.
- The Inspector panel shows you the properties of whatever object you have selected, so it will change depending on what you've clicked on in the other panels.
- Now head down to the Hierarchy panel and click on Create, then Folder. Let's name the folder "models" - this is where we're going to save our level.
now make something to walk around in
- Now open SketchUp. Make a big flat rectangle. You can use the rectangle tool to do that, which looks like this:
- Put some other stuff on top of it. Use the push/pull tool to make shapes go from flat to 3D. It looks like this:
- Save it as a SketchUp file (.skp) and then go to File -> Export -> 3D Model. Choose the .fbx filetype, then click on options. You will see a screen with some options on it. Make it look like this:
BE SURE TO SAVE IT IN THE "MODEL" FOLDER we created in Unity (you can usually find this in "My Documents").
- Now go back to Unity. The model should show up in the Projects panel in your model folder. Click on it once. Look in the Inspector panel. Make sure the Scale Factor (how big the model is) is set to "1" and then click apply. It should look like this:
- Drag the model from the Projects panel into the Hierarchy panel. Can't see all the model? Click on it in the Hierarchy panel and then go to Edit -> Frame Selected.
- Go back to SketchUp and make your model EVEN MORE AWESOME. Add some colors. Make it gigantic and weird. Each time you change something, repeat the File -> Export -> 3D Model and overwrite your last version of the model. Unity will automatically update with the new version.
add a player
- Delete the main camera from the Hierarchy panel by clicking on it and then pushing the delete button.
- We're going to bring in a package - a set of scripts - that make for a nice first-person player controller. Download First-Person Drifter, then go to Assets -> Import Package -> Custom Package and navigate to where you downloaded the Drifter package.
- A window pops up offering you lots of crazy checkboxes. Just click the Import button.
- There should now be a new folder named First Person Drifter in your Project panel. Open it up, and drag the Player up into the Hierarchy panel.
- One last thing before you get to play a game: we need to tell Unity what is solid, so that the player doesn't fall through the model into an endless abyss. In the Hierarchy panel, click on the arrow next to your model. Look for something that says "Mesh" (it may have several, in which case just do the following with all of them). Click on the mesh.
- Now look at the Inspector panel. Scroll to the bottom of that panel and click a button that says Add Component.
- A search bar will pop up. Start typing in "mesh" and you should see an option that says Mesh Collider. Pick that one.
This will set up the mesh - the geometry of your model - as something that collides with the player, keeping your player from, again, plunging into an abyss and making your game super short and unsatisfying.
- Finally time to play! Hit the play button (it looks like the play button on your DVD remote) on the top of the Scene panel. You can now wander around a dark and gloomy place you made.
make it more fancier
- Maybe you don't want it to be so gloomy? In the Hierarchy panel, click on Create -> Light -> Directional Light.
- Are you walking too slow? Too fast? Click on the Player in the Hierarchy panel and then look over at the Inspector panel. In a panel that says "First Person Drifter Script," you can type in new values for how fast you walk and run. Mess around. Click some stuff. If you break it, so what? It's not like the computer will catch fire.
- Change the color of the sky by clicking on the dropdown arrow next to Player in the Hierarchy panel, then clicking on Main Camera. If you look at the Inspector panel now, you'll see options to change the background and the ambient light. CLICKY CLICKY.
- Want to make it even cooler? Go to Edit -> Render Settings and then mess around with the new options open in the Inspector panel. Turn on fog. Make it pink. Change the density. Keep playtesting, because that is the best part of making a game.
now make your own controller
- Plug in your MaKey MaKey. Figure out what you're going to use as a controller. Bananas? Tin foil? Your friend who is constantly giving you high-fives? There's a great primer to get started with your MaKey here.
- To set things up properly, we're going to have to map the output from the MaKey to the actions in Unity. To do this, go to Edit -> Project Settings -> Input.
- Now look at the Inspector panel. Hit the down arrow next to Axes. You'll see a bunch of options. Let's open up the Horizontal one. There's a lot of stuff in here, but the main one you want to worry about is the Negative Button and Positive Button - these move the player up and down the horizontal axis. Right now they're set up to the left and right keys. If you need to swap those out with another input from the Makey, just type in the key you're substituting. There's a list of acceptable key names here. So: horizontal will move the player left and right, "vertical" moves the player forward and backward (weird, I know).
- If you want to let your player run, open up the axis named Fire1, and change the name to "Run." (Make sure you make it "Run" and not "run" or "RUN" - for it to work with the player controller, the name has to match what's in the player script). You can then change that input to anything you want by changing the value under Positive Button.