- Learning C# by Developing Games with Unity 5.x(Second Edition)
- Greg Lukosek
- 1189字
- 2021-07-09 20:03:29
Preface
Hello, future game developers! If you are reading this book, you are probably a curious person trying to learn more about a great game engine—Unity—and specifically, programming in C#. This book will take you on a learning journey. We will go through it together, beginning with the fundamentals of programming and finishing with a functional 2D platform game.
What this book covers
Chapter 1, Discovering Your Hidden Scripting Skills and Getting Your Environment Ready, puts you at ease with writing scripts for Unity.
Chapter 2, Introducing the Building Blocks for Unity Scripts, helps you develop the skill of writing your first executable code.
Chapter 3, Getting into the Details of Variables, teaches you about creating and using C# variables, followed editing them in Unity Inspector.
Chapter 4, Getting into the Details of Methods, helps you learn more in detail about methods and how to use them to understand the importance of code blocks and the variables used in them.
Chapter 5, Lists, Arrays, and Dictionaries, introduces slightly more complex ideas of handling, lists, arrays, and dictionaries, which allow you to store many values at once.
Chapter 6, Conditions and Looping, helps you learn how to "ask" Unity to loop through a section of code and do something useful.
Chapter 7, Objects, a Containers with Variables and Methods, pes into the subjects of organizing your code and object-oriented programming.
Chapter 8, Let's Make a Game! – From Idea to Development, shows you how to turn an idea into a ready-to-code project and how to break down complex mechanics into pieces.
Chapter 9, Starting Your First Game, helps us transform an idea into a real Unity project.
Chapter 10, Writing GameManager, gets you acquainted with the basics of the singleton approach and also helps you work through the gameplay loop.
Chapter 11, The Game Level, helps you learn how to create reusable pieces of a level and also how to populate them to create the illusion of an endlessly running game.
Chapter 12, The User Interface, explains how to construct and implement the user interface in our game.
Chapter 13, Collectables — What Next?, focuses on collectables and storing some data between Unity sessions.
What you need for this book
You will definitely need a computer—PC, Mac, or any machine that supports Unity editor installation.
The complete Unity system requirements can be found at this link:
https://unity3d.com/unity/system-requirements
Who this book is for
The book is targeted at beginner-level Unity developers with no prior programming experience. If you are a Unity developer and wish to create games by learning how to write C# scripts or code, then this book is for you.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Add the Collectable
script to your coin
prefab."
A block of code is set as follows:
using UnityEngine; using System.Collections; public class LeaveTrigger : MonoBehaviour { void OnTriggerEnter2D(Collider2D other) { LevelGenerator.instance.AddPiece(); LevelGenerator.instance.RemoveOldestPiece(); } }
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "When you are ready, click on Play in Unity."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <feedback@packtpub.com>
, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for this book 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.
You can download the code files by following these steps:
- Log in or register to our website using your e-mail address and password.
- Hover the mouse pointer on the SUPPORT tab at the top.
- Click on Code Downloads & Errata.
- Enter the name of the book in the Search box.
- Select the book for which you're looking to download the code files.
- Choose from the drop-down menu where you purchased this book from.
- Click on Code Download.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR / 7-Zip for Windows
- Zipeg / iZip / UnRarX for Mac
- 7-Zip / PeaZip for Linux
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/LearningCbyDevelopingGameswithUnity5x_ColorImages.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at <questions@packtpub.com>
, and we will do our best to address the problem.
- Building Modern Web Applications Using Angular
- 看透JavaScript:原理、方法與實踐
- Raspberry Pi 2 Server Essentials
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第3版)
- 計算機應用基礎實踐教程
- C++從入門到精通(第5版)
- 搞定J2EE:Struts+Spring+Hibernate整合詳解與典型案例
- HTML5權威指南
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- 從Power BI到Analysis Services:企業級數據分析實戰
- Learning Splunk Web Framework
- Java EE架構設計與開發實踐
- Unity 5 Game Optimization
- C語言程序設計實驗指導與習題精解
- Android從入門到精通