You are previewing Unity 2D Game Development Cookbook.
O'Reilly logo
Unity 2D Game Development Cookbook

Book Description

Over 50 hands-on recipes that leverage the features of Unity to help you create 2D games and game prototypes

In Detail

Unity is a powerful game development engine that provides rich functionalities to create 2D and 3D games.

Unity 2D Game Development Cookbook is a practical guide to creating games with Unity. The book aims to serve the purpose of exploring problematic concepts in Unity for 2D game development, offering over 50 recipes that are easy to understand and to implement, thanks to the step-by-step explanations and the custom assets provided. The practical recipes provided in the book show clearly and concisely how to do things right in Unity. By the end of this book, you'll be near "experts" when dealing with Unity. You will also understand how to resolve issues and be able to comfortably offer solutions for 2D game development.

What You Will Learn

  • Import files from other popular software into Unity: Textures, Models, Animations, and Audio clips

  • Build up an actual game scene with cameras, lights, and the logic to control the game flow

  • Manage collisions, and implement physics and game controls

  • Make prefabs and instantiate them as game objects in the game scene

  • Import and configure music and sound effects to be added to your games

  • Design and control the user interface with the built-in methods of Unity

  • 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 2D Game Development Cookbook
      1. Table of Contents
      2. Unity 2D Game Development Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. The goal
        2. The mean
        3. The interface
          1. The words
          2. The assistants
        4. Start a new project in Unity
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Adding a folder to the project directory
          1. Getting ready
            1. The file structure
          2. How to do it...
          3. How it works...
        6. What this book covers
        7. What you need for this book
        8. Who this book is for
        9. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        10. Conventions
        11. Reader feedback
        12. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Importing 3D Models and Animations
        1. Introduction
        2. Setting up a scene in Maya
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Using groups to rotate FBX files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Exporting FBX files from Maya
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Configuring imported FBX files in Unity
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Exporting animations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Configuring imported animations in Unity Inspector
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      9. 2. 2D Assets for Unity
        1. Introduction
          1. About textures and materials
          2. File formats of textures
          3. Optimizing textures
        2. Importing textures and setting them to Inspector
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Configuring transparency
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Creating materials
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Setting materials' names in Maya
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Setting the ambient light in Unity
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Texture atlases
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Animated materials
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      10. 3. Animating a Game Character
        1. Introduction
        2. Creating the animation tree
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Dealing with transitions
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Coding the Boolean-based transitions
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Working with float parameters
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Coding the float-based transitions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more....
        7. Creating Blend Tree
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Animation layers – creating masks
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Animation layers – adding a second animation layer
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      11. 4. Taking Control
        1. Introduction
        2. Creating a bumped material
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
            1. Taking control of the game character
        3. Importing packages
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Setting the Character Controller
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There is more...
        5. Adding Rigidbody
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Coding physics controls
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Collision management
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There is more...
      12. 5. Building Up the Game Level
        1. Introduction
          1. Level design
          2. Making the background for the prototype
        2. Creating Prefabs
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Coding a scrolling background
          1. How to do it...
          2. How it works...
        4. Adding platforms
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Programming the character controls
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Setting up an Animator
          1. How to do it...
          2. How it works...
        7. Adding collectibles to the game level
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Camera setup and controls
          1. How to do it...
          2. How it works...
          3. There's more...
      13. 6. Game Scenes and the Graphic Interface
        1. Introduction
        2. The game manager
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more...
        3. Loading a new scene at runtime
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Setting game exit conditions – character death
          1. Getting ready
          2. How to do it…
          3. How it works…
        5. Setting game exit conditions – goals met
          1. Getting ready
          2. How to do it…
          3. How it works…
        6. Using OnGUI() to display game data
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more...
        7. Display the number of collected items
          1. Getting ready
          2. How to do it…
          3. How it works…
        8. Game Won and Game Over
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
      14. 7. Improving Your Gaming Experience
        1. Introduction
        2. Importing audio clips
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. The Audio Source component
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Coding audio
        5. Particle systems
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Instantiating a particle system at runtime
          1. Getting ready
          2. How to do it
          3. How it works...
        7. Game options – volume level
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Game options – toggling audio
          1. Getting ready
          2. How to do it...
        9. Playing videoclips in the scene
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      15. 8. Sprites, Spritesheets, and 2D Animation in Unity
        1. Introduction
        2. Setting up sprites
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Multiple sprites
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Animating with spritesheets
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Preparing the character sprites
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Parenting sprites
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Keyframe sprite animation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      16. Index