O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unity 2018 By Example - Second Edition

Book Description

Build exciting 2D/3D games and virtual reality applications with the help of hands-on examples

Key Features

  • Create five different types of games from scratch with Unity 2018
  • Import custom content into Unity from third-party tools such as Maya and Blender
  • Learn to build NPCs with artificial intelligent behavior.

Book Description

Unity is the most exciting and popular engine used for developing games. With its 2018 release, Unity has become the primary source of both game development and virtual reality content.

In Unity 2018 By Example, you'll learn how to use Unity in order to make amazing games from popular genres - from action shooters to mind-bending puzzle games to adventure and Virtual Reality (VR) games. Even if you have no previous experience of using Unity, this book will help you understand the toolsets it provides in depth. In addition to this, you'll understand how to create time-critical collection games, twin-stick space shooters, platformers, and action-fest games with intelligent enemies. Finally, you'll get to grips with creating VR games with the new toolsets introduced by Unity to help you develop amazing VR experiences.

To make things easier, you will be provided with step-by-step tutorials for making five great games in Unity 2018, along with a detailed explanation of all the fundamental concepts. By the end of this book, you'll have established a strong foundation in making games with Unity 2018.

What you will learn

  • Understand core Unity concepts, such as game objects, components, and scenes
  • Study level-design techniques for building immersive and interesting worlds
  • Make functional games with C# scripting
  • Use the toolset creatively to build games with different themes and styles
  • Handle player controls and input functionality
  • Work with terrains and world-creation tools
  • Get to grips with making both 2D and 3D games

Who this book is for

You don't need to have any previous experience with Unity to enjoy Unity 2018 By Example, although you need to have basic knowledge of C#.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Unity 2018 By Example - Second Edition
    1. Table of Contents
    2. Unity 2018 By Example - Second Edition
      1. Why subscribe?
      2. PacktPub.com
    3. Contributors
      1. About the author
      2. About the reviewer
      3. Packt is Searching for Authors Like You
    4. Preface
      1. Who this book is for
      2. What this book covers
      3. To get the most out of the book
        1. Download the example code files
        2. Download the color images
        3. Conventions used
      4. Get in touch
        1. Reviews
    5. 1. Unity Fundamentals
      1. Game design
      2. Getting started – Unity and projects
      3. Projects and project folders
      4. Importing assets
      5. Starting a level
      6. Transformations and navigation
      7. Scene building
      8. Lighting and sky
      9. Play testing and the Game tab
      10. Adding a water plane
      11. Adding a coin to collect
      12. Summary
      13. Test your knowledge
      14. Further Reading
    6. 2. Creating a Collection Game
      1. Creating a coin material
      2. C# scripting in Unity
      3. Counting coins
        1. Code Sample 2.3
      4. Collecting coins
        1. Code Sample 2.5
      5. Coins and prefabs
      6. Timers and countdowns
        1. Code Sample 2.6
      7. Celebrations and fireworks!
        1. Code Sample 2.7
      8. Play testing
      9. Building
      10. Summary
      11. Test your knowledge
      12. Further reading
    7. 3. Creating a Space Shooter
      1. Looking ahead – the completed project
      2. Getting started with a space shooter
      3. Creating a player object
      4. Player input
        1. Code Sample 3.1
      5. Configuring the game camera
      6. Bounds locking
        1. Code Sample 3.2
      7. Health
        1. Code Sample 3.3
      8. Death and particles
        1. Code Sample 3.4
      9. Enemies
        1. Code Sample 3.6
        2. Code Sample 3.7
        3. Code Sample 3.8
      10. Enemy spawning
        1. Code Sample 3.9
      11. Summary
      12. Test your knowledge
      13. Further reading
    8. 4. Continuing the Space Shooter
      1. Guns and gun turrets
      2. Ammo prefabs
        1. Code Sample 4-1
      3. Ammo spawning
        1. Code Sample 4.2
        2. Code Sample 4.3
      4. User controls
      5. Scores and scoring – UI and text objects
      6. Working with scores – scripting with text
        1. Code Sample 4.4
      7. Polishing
      8. Testing and diagnosis
      9. Building
      10. Summary
      11. Test your knowledge
      12. Further Reading
    9. 5. Creating a 2D Adventure Game
      1. A 2D Adventure – getting started
      2. Importing assets
      3. Creating an environment – getting started
      4. Environment Physics
      5. Creating a player
      6. Scripting the player movement
        1. Code Sample 5.1
      7. Optimization
      8. Summary
      9. Test your knowledge
      10. Further reading
    10. 6. Continuing the 2D Adventure
      1. Moving platforms
        1. Code Sample 6.1
      2. Creating other scenes – levels 2 and 3
      3. Kill zones
        1. Code Sample 6.2
      4. The UI health bar
        1. Code Sample 6.3
      5. Ammo and hazards
      6. Gun turrets and ammo
      7. NPCs and quests
        1. Code Sample 6.8
      8. Summary
      9. Test your knowledge
      10. Further Reading
    11. 7. Creating Artificial Intelligence
      1. An overview of the project
      2. Getting started
      3. Terrain construction
      4. Navigation and navigation meshes
      5. Building an NPC
        1. Code Sample 7.1
      6. Creating patrolling NPCs
      7. Summary
      8. Test your knowledge
      9. Further Reading
    12. 8. Continuing with Intelligent Enemies
      1. Enemy AI – range of sight
        1. Code Sample 8.1
      2. An overview of Finite State Machines
        1. Code Sample 8.2
      3. The Patrol state
        1. Code Sample 8.3
      4. The Chase state
        1. Code Sample 8.4
      5. The Attack state
        1. Code Sample 8.5
      6. Summary
      7. Test your knowledge
      8. Further Reading
    13. 9. Entering Virtual Reality
      1. Project Overview – Getting Started
      2. Setting Scene Lighting
      3. Post-Processing Stack 2
      4. Preparing for VR
      5. Summary
      6. Test your knowledge
    14. 10. Completing the VR Game
      1. Object Pool and Spawning
        1. Code Sample 10.1
        2. Code Sample 10.2
      2. Creating Intelligent Enemies – Navigation
      3. Creating Intelligent Enemies – FSMs
        1. Code Sample 10.3
        2. Code Sample 10.4
      4. Attack and Damage
        1. Code Sample 10.5
      5. Summary
      6. Test your knowledge
    15. A. Test Your Knowledge Answers
      1. Chapter 1- Unity Fundamentals
      2. Chapter 2- Creating a Collection Game
      3. Chapter 3- Creating a Space Shooter
      4. Chapter 4- Continuing the Space Shooter
      5. Chapter 5- Creating a 2D Adventure
      6. Chapter 6- Continuing the 2D Adventure
      7. Chapter 7- Creating Artificial Intelligence
      8. Chapter 8- Continuing with Intelligent Enemies
      9. Chapter 9- Entering Virtual Reality
      10. Chapter 10- Completing the VR Game
    16. Other Books You May Enjoy
      1. Leave a review - let other readers know what you think
    17. Index