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

Book Description

In Pro Unity Game Development with C#, Alan Thorn, author of Learn Unity for 2D Game Development and experienced game developer, takes you through the complete C# workflow for developing a cross-platform first person shooter in Unity. C# is the most popular programming language for experienced Unity developers, helping them get the most out of what Unity offers. If you're already using C# with Unity and you want to take the next step in becoming an experienced, professional-level game developer, this is the book you need.

Whether you are a student, an indie developer, or a season game dev professional, you'll find helpful C# examples of how to build intelligent enemies, create event systems and GUIs, develop save-game states, and lots more.

You'll understand and apply powerful programming concepts such as singleton classes, component based design, resolution independence, delegates, and event driven programming.

By the end of the book, you will have a complete first person shooter game up and running with Unity. Plus you'll be equipped with the know-how and techniques needed to deploy your own professional-grade C# games.

If you already know a bit of C# and you want to improve your Unity skills, this is just the right book for you.

What you'll learn

  • How to plan your game in terms of C# and classes

  • How to import assets from Blender and Maya, including C# automation processes

  • How to handle events and notifications using a C# event notification system

  • How to create intelligent enemies and collectible weapons

  • How to build a cross-platform controller as well as how to write platform-specific code

  • How to develop a resolution-independent graphical user interface

  • Who this book is for

    If you already know a bit of C# and you want to improve your Unity skills, this is just the right book for you. Unity developers looking to improve their C# workflow and effectiveness, including game development students and professionals, indie developers, artists, designers, and those employed at game development studios.

    Table of Contents

    1. Title Page
    2. Contents at a Glance
    3. Contents
    4. About the Author
    5. About the Technical Reviewer
    6. Acknowledgments
    7. Introduction
    8. Chapter 1: Designing and Preparing
      1. Designing
      2. Game Overview
      3. Game in Depth
      4. Developing the Design: Looking Ahead
      5. Game Development Workflows
      6. Tip #1: Interface Layout
      7. Tip #2: Dual-Monitors
      8. Tip #3: Be Organized
      9. Tip #4: Show Project Wizard on Start-up
      10. Tip #5: Use FBX Meshes
      11. Tip #6: Disable Ambient Lighting
      12. Tip #7: Use Root GameObjects
      13. Tip #8: Incremental Backups
      14. Tip #9: Batch Renaming
      15. Tip #10: Showing Empty Objects in the Editor
      16. Tip #11: Use the Stats Panel
      17. Tip #12: Testing Resolution and Aspect Ratio
      18. Conclusion
    9. Chapter 2: Getting Started
      1. Step 1: Create Folders
      2. Step 2: Importing Textures and Meshes
      3. Step 3: FBX Meshes and Scale Factor
      4. Step 4: Configuring Meshes
      5. Step 5: Planning and Configuring Textures
      6. Step 6: Building Sprites
      7. Step 7: Importing Audio
      8. Step 8: Create Prefabs
      9. Step 9: Scene Building
      10. Step 10: Lighting and Lightmapping
      11. Step 11: Building a Navigation Mesh
      12. Conclusion
    10. Chapter 3: Event Handling
      1. Events and Responses
      2. Event Handling
      3. Planning Event Handling
      4. Planning a Dedicated Event-Handling System
      5. Getting Started with NotificationsManager
      6. Keeping Track of Notifications with .NET Dictionaries
      7. Generic Classes and C#
      8. Registering As a Listener
      9. Posting Notifications
      10. SendMessage and BroadcastMessage
      11. Removing Listeners
      12. Removing Redundancies
      13. Completing NotificationsManager
      14. Working with the NotificationsManager
      15. Conclusion
    11. Chapter 4: Power-Ups and Singletons
      1. Creating the Cash Power-Up
      2. Power-Ups and Billboards
      3. Billboards and Cached Transforms
      4. Billboards and Rotation
      5. Billboards and Bobbing
      6. Coroutines
      7. Power-Up Motion with Coroutines and deltaTime
      8. Exploring deltaTime
      9. Completing Power-Up Bobbing
      10. Power-Up Collision
      11. Handling Collision Events: Getting Started
      12. Collisions and Responses
      13. Introducing the GameManager
      14. GameManager and Singletons
      15. GameManager and Event Handling
      16. Completing the Cash Power-Up
      17. Making a Prefab from the Completed Power-Up
      18. Creating Other Prefabs
      19. Conclusion
    12. Chapter 5: Player Controller
      1. Character Controllers and the First Person Controller
      2. Multiplatform Development
      3. Beginning the Universal First Person Controller
      4. Platform Dependent Compilation
      5. Head Bobbing and Sine Waves
      6. First-Person Capsule Mesh
      7. Handling Cash Collection
      8. Life and Death: Getting Started
      9. Making Death: Scripting with Mecanim
      10. Implementing Health
      11. Health and Damage: Procedural Textures
      12. GUIs
      13. Conclusion
    13. Chapter 6: Weapons
      1. Weapons Overview
      2. Object Orientation: Classes and Instances
      3. Object Orientation: Inheritance
      4. Animations, Frames, and Prefabs
      5. Cameras: Layers and Rendering
      6. Cameras: Orthographic Size
      7. Weapon Implementation: Punching
      8. Physics and Damage Dealing
      9. Weapon Changing and Polymorphism
      10. Completing the Punch and Gun Weapons
      11. Conclusion
    14. Chapter 7: Enemies
      1. Meet the Bad Guys
      2. Starting the Enemy Drone Prefab
      3. Coding Enemy Damage
      4. Improving Damage Dealing: Feedback
      5. Enemies, Intelligence, and Philosophical Zombies
      6. Finite State Machines (FSMs)
      7. Changing Between States
      8. Preparing for State Implementation
      9. The Patrol State
      10. Refining the Patrol State
      11. The Chase and Attack States
      12. Adding More Enemy Types
      13. Summary
    15. Chapter 8: Graphical User Interfaces
      1. GUIs in Games
      2. Getting Started with GUIs
      3. Resolution Dependence and Independence
      4. Main Menu and Aspect Ratio
      5. Testing the Main Menu
      6. Adding Buttons to the Main Menu
      7. Handling Button Presses
      8. HUD: Ammo and Health Statuses
      9. Summary
    16. Chapter 9: Handling Persistent Data
      1. Persistent Data: PlayerPrefs, Binary Data, and More
      2. Saving with XML
      3. Getting Started with XML: Serialization
      4. Loading from and Saving to an XML File
      5. Completing the GameManager Class
      6. Completing the PlayerController Class
      7. Completing the Enemy Class
      8. Testing Save and Load Functionality
      9. Summary
    17. Chapter 10: Refinements and Improvements
      1. Level Changing
      2. Event Handling
      3. Write Shorter Code
      4. C# Features or Quirks?
      5. Summary
    18. Index