easy 3D exploration games with Unity, SketchUp, and MakeyMakey

Adapted from this great tutorial from KO-OP.
  1. Install Unity and SketchUp. They're free and awesome, so you should already have them because you are also awesome.
  2. get things ready in Unity

  3. 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.
  4. 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:
  5. 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.
  6. now make something to walk around in

  7. Now open SketchUp. Make a big flat rectangle. You can use the rectangle tool to do that, which looks like this:
  8. 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:
  9. 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").
  10. 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:
  11. 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.
  12. 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.
  13. add a player

  14. Delete the main camera from the Hierarchy panel by clicking on it and then pushing the delete button.
  15. 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.
  16. A window pops up offering you lots of crazy checkboxes. Just click the Import button.
  17. 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.
  18. 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.
  19. Now look at the Inspector panel. Scroll to the bottom of that panel and click a button that says Add Component.
  20. 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.
  21. 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.
  22. make it more fancier

  23. Maybe you don't want it to be so gloomy? In the Hierarchy panel, click on Create -> Light -> Directional Light.
  24. 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.
  25. 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.
  26. 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.
  27. now make your own controller

  28. 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.
  29. 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.
  30. 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).
  31. 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.