Table of Contents
Preface
Chapter 1: Welcome to the Third Dimension
Chapter 2: Environments
Chapter 3: Player Characters
Chapter 4: Interactions
Chapter 5: Prefabs, Collection, and HUD
Chapter 6: Instantiation and Rigid Bodies
Chapter 7: Particle Systems
Chapter 8: Menu Design
Chapter 9: Finishing Touches
Chapter 10: Building and Sharing
Chapter 11: Testing and Further Study
Index
- Chapter 1: Welcome to the Third Dimension
- Getting to grips with 3D
- Coordinates
- Local space versus World space
- Vectors
- Cameras
- Polygons, edges, vertices, and meshes
- Materials, textures, and shaders
- Rigid Body physics
- Collision detection
- Essential Unity concepts
- The Unity way
- Assets
- Scenes
- Game Objects
- Components
- Scripts
- Prefabs
- The Unity way
- The interface
- The Scene window and Hierarchy
- The Inspector
- The Project window
- The Game window
- Summary
- Getting to grips with 3D
- Chapter 2: Environments
- External modellers
- Resources
- Your first Unity project
- Using the terrain editor
- Terrain menu features
- Importing and exporting heightmaps
- Set Heightmap resolution
- Creating the lightmap
- Mass Place Trees
- Flatten Heightmap
- Refresh Tree and Detail Prototypes
- The terrain toolset
- Terrain Script
- Raise Height
- Paint height
- Smooth height
- Paint Texture
- Place Trees
- Paint Details
- Terrain Settings
- Sun, Sea, Sand—creating the island
- Take Me Home! Introducing models
- Importing the model package
- Common settings for models
- Setting up the outpost model
- Terrain menu features
- Summary
- Chapter 3: Player Characters
- Working with the Inspector
- Tags
- Layers
- Prefabs and the Inspector
- Deconstructing the First Person Controller object
- Parent-child issues
- First Person Controller objects
- Object 1: First Person Controller (parent)
- Object 2: Graphics
- Object 3: Main Camera
- Scripting basics
- Commands
- Variables
- Functions
- If else statements
- Globals and dot syntax
- Comments
- Further reading
- Working with the Inspector
- The FPSWalker script
- Launching the script
- Deconstructing the script
- Summary
- Chapter 4: Interactions
- Exploring collisions
- Ray casting
- The frame miss
- Predictive collision detection
- Adding the outpost
- Positioning
- Scaling
- Colliders and tagging the door
- Disabling automatic animation
- Opening the outpost
- Approach 1—Collision detection
- Creating new assets
- Scripting for character collision detection
- Attaching the script
- Approach 2—Ray casting
- Disabling collision detection—using comments
- Resetting the door collider
- Adding the ray
- Approach 1—Collision detection
- Summary
- Chapter 5: Prefabs, Collection, and HUD
- Creating the battery prefab
- Download, import, and place
- Tagging the battery
- Scale, collider, and rotation
- Enlarging the battery
- Adding a trigger collider
- Creating a rotation effect
- Saving as a prefab
- Scattering batteries
- Displaying the battery GUI
- Creating the GUI Texture object
- Positioning the GUI Texture
- Scripting for GUI change
- Battery collection with triggers
- Restricting outpost access
- Restricting access
- Utilizing GetComponent()
- Hints for the player
- Battery GUI hint
- GUI Text hint
- Using fonts
- Restricting access
- Summary
- Creating the battery prefab
- Chapter 6: Instantiation and Rigid Bodies
- Introducing instantiation
- In concept
- In code
- Passing in an object
- Position and rotation
- Introducing rigid bodies
- Forces
- The Rigidbody component
- Making the minigame
- Creating the coconut prefab
- Creating the textured coconut
- Adding physics
- Saving as a prefab
- Creating the Launcher object
- Scripting coconut throws
- Checking for player input
- Playing feedback sound
- Instantiating the coconut
- Naming instances
- Assigning velocity
- Safeguarding collisions
- Script and variable assignment
- Instantiate restriction and object tidying
- Activating coconut throw
- Removing coconuts
- Adding the coconut shy platform
- Import settings
- Placement
- Coconut detection script
- Script assignment
- Making more targets
- Winning the game
- Variable setup
- Checking for a win
- Script assignment
- Incrementing and decrementing targets
- Finishing touches
- Adding the crosshair
- Informing the player
- Creating the coconut prefab
- Summary
- Introducing instantiation
- Chapter 7: Particle Systems
- What is a particle system?
- Particle emitter
- Particle Animator
- Particle Renderer
- In summary
- Making the task
- Asset download
- Adding the log pile
- Creating the fire particle systems
- Making fire
- Making smoke
- Adding audio to the fire
- Lighting the fire
- Adding the matches
- Creating the Matches GUI
- Collecting the matches
- Setting fire
- Testing and confirming
- Summary
- What is a particle system?
- Chapter 8: Menu Design
- Interfaces and menus
- Making the main menu
- Creating the scene
- Cancelling mip mapping
- Adding titling
- Making the main menu
- Creating the menu—approach 1
- Adding the play button
- GUI Texture button script
- Assigning public member variables
- Adding the instructions button
- Adding the quit button
- Using debug commands to check scripts
- Adding the play button
- Creating the menu—approach 2
- Disabling Game Objects
- Writing an OnGUI() script for a simple menu
- Fixed versus layout
- Public member variables
- The OnGUI() function
- Flexible positioning for GUIs
- Adding UnityGUI buttons
- Opening scenes with custom functions
- GUI skin settings
- Decision time
- Summary
- Interfaces and menus
- Chapter 9: Finishing Touches
- Volcano!
- Positioning the particle system
- Downloading assets
- Making the smoke material
- Particle system settings
- Ellipsoid Particle Emitter settings
- Particle Animator settings
- Adding audio to the volcano
- Volcano testing
- Coconut trails
- Editing the Prefab
- Trail Renderer component
- Updating the prefab
- Performance tweaks
- Camera Clip Planes and fog
- Ambient lighting
- Instructions scene
- Adding screen text
- Text Animation using Linear Interpolation (Lerp)
- Menu return
- Island level fade-in
- UnityGUI texture rendering
- Game win notification
- Summary
- Volcano!
- Chapter 10: Building and Sharing
- Build Settings
- Web Player
- Player Settings
- Web Player Streamed
- OS X Dashboard Widget
- OS X/Windows Standalone
- Web Player
- Building the game
- Adapting for web build
- Texture compression and debug stripping
- Building standalone
- Indie versus Pro
- Building for the Web
- Adapting web player builds
- Quality Settings
- Player Input settings
- Sharing your work
- Summary
- Build Settings
- Chapter 11: Testing and Further Study
- Testing and finalizing
- Public testing
- Frame rate feedback
- Boosting performance
- Public testing
- Approaches to learning
- Cover as many bases as possible
- If you don't know, just ask!
- Summary
- Testing and finalizing