Learning C# by Developing Games with Unity 5. x
Book information
Description
Develop your first interactive 2D platformer game by learning the fundamentals of C#About This Book Get to grips with the fundamentals of scripting in C# with Unity Create an awesome, 2D platformer game from scratch using the principles of object-oriented programming and coding in C# This is a step-by-step guide to learn the fundamentals of C# scripting to develop GameObjects and master the basics of the new UI system in UnityWho This Book Is ForThe book is targeted at beginner level Unity developers with no programming experience. If you are a Unity developer and you wish to learn how to write C# scripts and code by creating games, then this book is for you. What You Will Learn Understand the fundamentals of variables, methods, and code syntax in C# Get to know about techniques to turn your game idea into working project Use loops and collections efficiently in Unity to reduce the amount of code Develop a game using the object-oriented programming principles Generate infinite levels for your game Create and code a good-looking functional UI system for your game Publish and share your game with usersIn DetailUnity is a cross-platform game engine that is used to develop 2D and 3D video games. Unity 5 is the latest version, released in March 2015, and adds a real-time global illumination to the games, and its powerful new features help to improve a game's efficiency. This book will get you started with programming behaviors in C# so you can create 2D games in Unity. You will begin by installing Unity and learning about its features, followed by creating a C# script. We will then deal with topics such as unity scripting for you to understand how codes work so you can create and use C# variables and methods. Moving forward, you will find out how to create, store, and retrieve data from collection of objects. You will also develop an understanding of loops and their use, and you'll perform object-oriented programming. This will help you to turn your idea into a ready-to-code project and set up a Unity project for production. Finally, you will discover how to create the GameManager class to manage the game play loop, generate game levels, and develop a simple UI for the game. By the end of this book, you will have mastered the art of applying C# in Unity. Style and approachThis is a step-by-step guide to developing a game from scratch by applying the fundamentals of C# and Unity scripting.;Cover ; Copyright; Credits; About the Author; About the Reviewer; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Discovering Your Hidden Scripting Skills and Getting Your Environment Ready; Prerequisite knowledge to use this book; Dealing with scriptphobia; Downloading Unity; Obtaining a free license; Teaching behavior to GameObjects; Using Unity's documentation; Do I need to know all that?; C# documentation -- where to find it? Do I need it at all?; The Unity community -- asking others for help; Working with C# script files; Lots of files can create a mess. Cover Copyright Credits About the Author About the Reviewer www.PacktPub.com Table of Contents Preface Chapter 1: Discovering Your Hidden Scripting Skills and Getting Your Environment Ready Prerequisite knowledge to use this book Dealing with scriptphobia Downloading Unity Obtaining a free license Teaching behavior to GameObjects Using Unity's documentation Do I need to know all that? C# documentation -- where to find it? Do I need it at all? The Unity community -- asking others for help Working with C# script files Lots of files can create a mess. Why does my Project tab look different?Creating a C# script file Introducing the MonoDevelop code editor Syncing C# files between MonoDevelop and Unity Opening LearningScript in MonoDevelop The namespace -- highlighted in blue The class definition -- highlighted in green Watching for possible gotchas while creating script files in Unity Fixing synchronization if it isn't working properly Adding our script to GameObject Instance? What is it? Summary Chapter 2 : Introducing the Building Blocks for Unity Scripts Understanding what a variable is and what it does Naming a variable. A variable name is just a substitute for a valueCreating a variable and seeing how it works Declaration Assignment Click on Play! Changing variables Watching for a possible gotcha when using public variables What is a method? Using the term method instead of function -- Method names are substitutes, too Introducing the class Inheritance The Start(), Update(), and Awake() methods and the execution order Components that communicate using dot syntax What's with the dots? Making decisions in code Using the NOT operator to change the condition. Checking many conditions in an if statementUsing else if to make complex decisions Making decisions based on user input Paper and pencil are powerful tools Summary Chapter 3 : Getting into the Details of Variables Writing C# statements properly Understanding component properties in Unity's Inspector Variables become component properties Unity changes script and variable names slightly Changing a property's value in the Inspector panel Displaying public variables in the Inspector panel Private variables Naming your variables properly Beginning variable names with lowercase. Using multiword variable namesDeclaring a variable and its type The most common built-in variable types Assigning values while declaring a variable Where you declare a variable is important Variable scope -- determining where a variable can be used Summary Chapter 4 : Getting into the Details of Methods Using methods in a script Naming methods properly Beginning method names with an uppercase letter Using multiword names for a method Parentheses are part of the method's name Defining a method the right way The minimum requirements for defining a method. Understanding parentheses -- why are they there?
Similar books
Mastering scientific computing with R: learn advanced C♯ tips and techniques to make professional-grade games with Unity
2015 · EPUB
Learning C# by Developing Games with Unity 5. x
2016 · EPUB
Building an RPG with Unreal: get to grips with building the foundations of an RPG using Unreal Engine 4
2016 · MOBI
Building an RPG with Unreal 4.x: get to grips with building the foundations of an RPG using Unreal Engine 4.x
2016 · EPUB
3D Game Design with Unreal Engine 4 and Blender
2016 · EPUB
Daniel Arbuckle's Mastering Python
2017 · MOBI
The French Intifada: The Long War Between France and Its Arabs
2014 · MOBI
The Genie Within: Your Subconscious Mind
2011 · MOBI