You are previewing Game Development with Unity.
O'Reilly logo
Game Development with Unity

Book Description

GAME DEVELOPMENT WITH UNITY shows readers how to use the Unity game engine, a multiplatform engine and editor in one, to build games. Perfect for new developers or those looking to create games with an easy, efficient, and inexpensive game engine, they'll find a complete overview of the Unity editor along with basic game and level design theory taught alongside so they can build their game development skill set. New concepts and skill are taught using step-by-step tutorials and questions, as well comprehensive projects. GAME DEVELOPMENT WITH UNITY covers everything from building game assets, to adding interactivity, to polishing your finished game and publishing it.

Table of Contents

  1. Copyright
    1. Dedication
  2. About the Author
  3. I. In the Beginning. . .
    1. 1. Preface
      1. Inboxes and Emails
    2. 2. Introduction
      1. What Will Be Covered (and What Not)
      2. Intended Audience
      3. The Book’s Structure
      4. Installation Instructions
        1. The Unity Engine
        2. Using the DVD Contents
        3. Optional Installs
    3. 3. An Overview of the Unity Engine
      1. Getting Acquainted with the Interface
        1. The Project View
        2. The Hierarchy View
        3. The Inspector
        4. The Toolbar
        5. The Scene View
          1. Camera Navigation
          2. Advanced Viewing Options
          3. Manipulating Objects
          4. Moving Multiple and Parented Objects
          5. Transform Gizmo Toggles
        6. The Game View
        7. The Animation View
        8. The Console and Status Bar
        9. The Profiler and Asset Server
        10. Customizing the Editor
      2. Unity’s Basic Concepts
      3. Available Unity Licenses
      4. Editor Summary
    4. 4. Your First Game: Where to Start?
      1. Basic Design Theory
      2. Finding the Core Idea
        1. Brainstorming
        2. Researching Other Games
        3. Paper Prototyping: It’s Not Just for Business Software
      3. Planning It All Out
        1. A Basic Outline
        2. A Simple Level Document
      4. Getting Started
  4. II. Assembling the Game Assets
    1. 5. Setting the Stage with Terrain
      1. Unity’s Terrain Engine
      2. Customizing Terrain
        1. Building Height Using a Heightmap
        2. Painting Height Using Brushes
        3. Painting Textures
        4. Placing Trees
        5. Cluttering It Up with Grasses and Detail Meshes
        6. Terrain Settings
      3. Lighting and Shadows
      4. Adding a Skybox and Distance Fog
      5. Adding Water to Your Terrain
    2. 6. Building Your Environment: Importing Basic Custom Assets
      1. Design First, Then Build
      2. Importing Textures
        1. More on Importation
        2. Supported Formats
        3. Importing Textures for Widgets Terrain
      3. Importing Basic Meshes
      4. Setting Up Simple Shaders and Materials
        1. Unity-Provided Shaders
        2. Bumps, Spec, Cubes, and Details
          1. Bump Maps
          2. specular and Illumination Maps
          3. Cube Maps
          4. Detail Maps
        3. Assigning Shaders and Materials
        4. Making a Custom Skybox Material
        5. Adding Water
      5. Helpful Tips for Working with Assets
        1. Prefabs, Prefabs, Prefabs!
        2. Mass Selecting and Grouping Objects
        3. Snapping to the Grid
        4. Reworking the Terrain
    3. 7. Creating Characters
      1. Basic PC 101
      2. Importing Characters and Other Nonstatic Meshes
        1. Introducing Widget
  5. III. Bringing Your Props to Life with Interactivity
    1. 8. Scripting in Unity
      1. One Editor, Three Languages, a Whole Lotta Choice
      2. Picking a Script Editor, or, Do you Want Autocompletion with That?
      3. Fundamentals of Scripting in Unity
        1. Variables
          1. Common Variable Types
            1. Number Variables
            2. String Variables
            3. Booleans
            4. Arrays
            5. Enum
            6. Component-Specific
          2. Options for Declaring Variables
      4. Operators and Comparisons
        1. Operators
        2. Comparisons
      5. Conditionals
        1. The if Statement
        2. The if-else Statement
        3. The switch Statement
        4. The Conditional Operator
      6. Loops
        1. The for Loop
        2. The while Loop
      7. Functions
      8. Variable Scope
      9. Naming Conventions
    2. 9. Writing the Character and State Controller Scripts
      1. Setting It Up and Laying It Out
      2. A Simple Third-Person Controller
        1. Controller Variables
        2. Unity’s MonoBehaviour Class
        3. FixedUpdate: Make Widget Move
      3. Setting Up Unity’s Input Manager
        1. A Redux of the Input Class
        2. Naming Conventions for the Axes
        3. Sample Xbox-Style Controller Setup
      4. Hooking Up the Camera
      5. Assembling the Status Controller
        1. Coroutines
        2. Updating the Character Controller
      6. Completed Scripts
        1. Widget_Controller.js
        2. Widget_Status.js
        3. Widget_Camera.js
    3. 10. Hooking Up the Animations
      1. Animation in Unity
      2. Animation API
        1. The Animation Class
          1. Important Member Variables
          2. Often-Used Functions
      3. Setting Up the PC’s Animations
        1. Defining the Problem
        2. Updating the Controller
        3. Creating the Animation State Manager
      4. Creating Animations Inside Unity
        1. Some Basic Concepts
        2. Animation View
      5. Setting Up a New Animation Clip
        1. Creating the Custom Animation
        2. Hooking It Up
      6. Adding Animation Events
      7. Completed Scripts
        1. Widget_Controller.js Update
        2. Widget_Animation.js
    4. 11. Using Triggers and Creating Environment Interactions
      1. Triggers and Collision
      2. Setting Up a Basic Trigger Object
        1. Gizmos for Sanity
        2. Inventory Management
      3. Setting Up Other Kinds of Triggers
        1. Death Triggers
        2. Checkpoints—The Anti-Death Trigger
      4. Completed Scripts
        1. PickupItems.js
        2. Widget_Inventory.js
        3. DamageTrigger.js
        4. CheckPoint.js
        5. Widget Status
    5. 12. Building Adversaries and AI
      1. Artificial Intelligence: Definitely Artificial, Not Much Intelligence
        1. Some Simple AI Guidelines
        2. A Simple Workflow
      2. Setting Up a Simple Enemy
        1. The AI Controller
        2. A Simple State Manager for a Simple Bunny
      3. Hooking Up Widget’s Attacks
      4. Rewarding the Player for a Job Well Done
      5. Spawning and Optimization
      6. Completed Scripts
        1. EBunny_AIController.js
        2. EBunny_Status.js
        3. Widget_AttackController.js
        4. Enemy_RespawnPoint.js
    6. 13. Designing the Game’s GUI (Graphical User Interface)
      1. Basic Interface Theory
        1. Steps of Interaction
        2. Designing for Your Users
      2. Unity’s GUI System
        1. Buttons
        2. Sliders
        3. Labels and Boxes
        4. Text Entry
        5. Toggle
        6. Toolbars and Selection Grids
        7. Windows
      3. A Custom Skin for Widget
        1. Creating the GUISkin
        2. Defining Custom Styles
        3. Importing New Fonts
      4. Setting Up the HUD
        1. GUIContent
        2. Character Displays
          1. Widget’s Character Display
          2. The Enemy’s Display Panel
        3. Resolution
      5. A Sample Pop-up Screen
      6. Adding Full-Screen Menus
      7. Completed and Updated Scripts
        1. GULCustomControls.js
        2. GUI_HUD.js
        3. Widget_Attack_Controller.js
        4. EBunny_Status.js
        5. GUI_WaypointStore.js
        6. WaypointBehavior.js
        7. GUI_MainMenu.js
  6. IV. Polish and the Finishing Touches
    1. 14. Creating Lighting and Shadows
      1. Types of Lights
        1. Light Properties
        2. Basics of Lighting
          1. A Simple Three-Point Lighting Rig
          2. Lighting for Different Functions
      2. Lighting the World
      3. Creating Shadows
        1. Lightmaps
        2. Projector-Made Shadows
      4. Other Light Effects
        1. Lens Flares
        2. Cookies
    2. 15. Using Particle Systems
      1. Particles: From Smoke to Stardust
      2. Setting Up a Simple System
        1. Particle Emitter
        2. Particle Animator
        3. Particle Renderer and Materials
      3. Advanced Particle Components
        1. World Particle Collider
        2. Trail Renderer
        3. Line Renderer
      4. Particles for Widget
        1. Pickup Items
        2. Checkpoint Activation
        3. Widget’s Attack
        4. Enemy Explosion
      5. Updated Scripts
        1. CheckPoint.js
        2. Widget_AttackController.js
        3. EBunny_Status
    3. 16. Adding Audio and Music
      1. Feedback and Ambience
      2. Setting Up a Simple Audio Clip
        1. Ambient Sound Effects
        2. Controlling Sounds Through Scripts
        3. Adding Background Music
      3. Updated Scripts
  7. V. Publishing and Distributing Builds
    1. 17. Basic Unity Debugging and Optimization
      1. Debugging in Unity
        1. The Console
        2. The Log Files
      2. Optimization
        1. The Profiler
        2. Basic Code Optimization
          1. Static Typing
          2. Cache Lookups to Components
          3. Cull Based on Player Location
        3. Rendering Statistics Page
        4. Reducing File Size
        5. Other Ways to Optimize Graphics
    2. 18. Creating the Final Build
      1. Prepping for the Build
        1. Setting Up the Player
        2. Finally, the Application Class
        3. Build Settings
      2. Other Build Features
        1. New Assets and DLC
          1. Asset Bundles
          2. Resource Folders
        2. Packing Up Assets for Later
      3. The End of the Road?