Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning C# 7 By Developing Games with Unity 2017

You're reading from   Learning C# 7 By Developing Games with Unity 2017 Learn C# Programming by building fun and interactive games with Unity

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher Packt
ISBN-13 9781788478922
Length 290 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Micael DaGraça Micael DaGraça
Author Profile Icon Micael DaGraça
Micael DaGraça
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Discovering Your Hidden Scripting Skills and Getting Your Environment Ready FREE CHAPTER 2. Introducing the Building Blocks for Unity Scripts 3. Getting into the Details of Variables 4. Getting into the Details of Methods 5. Lists, Arrays, and Dictionaries 6. Loops 7. Object, a Container with Variables and Methods 8. Let's Make a Game! – from Idea to Development 9. Starting Your First Game 10. Writing GameManager 11. The Game Level 12. The User Interface 13. Collectables 14. Enemies 15. Audio, 3D Games, and Export

Dealing with scriptphobia

You've got Unity up and running, studied the interface, and added some GameObjects to the scene. Now you're ready to have those GameObjects move around, listen, speak, pick up other objects, shoot the bad guys, or do anything else that you can dream of. So you click Play, and nothing happens. Well, darn it all anyway!

You've just learned a big lesson: all those fantastic, highly detailed GameObjects are dumber than a hammer. They don't know anything, and they surely don't know how to do anything.

So, you proceed to read the Unity Forums, study some scripting tutorials, and maybe even copy and paste some scripts to get some action going when you click Play. That's great, but then you realize that you don't understand anything in the scripts you've copied. Sure, you probably recognize the words, but you fail to understand what those words do or mean in a script.

You look at the code, your palms get sweaty, and you think to yourself, "I'll never be able to write scripts!" Perhaps you have scriptphobia: a fear of not being able to write instructions (I made that up). Is that what you have?

The fear that you cannot write down instructions in a coherent manner? You may believe you have this affliction, but you don't. You only think you do.

The basics of writing code are quite simple. In fact, you do things every day that are just like the steps executed in a script. For example, do you know how to interact with other people? How to operate a computer? Do you fret so much about making a bologna sandwich that you have to go to an online forum and ask how to do it?

Of course you don't. In fact, you know these things as everyday routines or maybe habits. Think about this for a moment: do you have to consciously think about the routines that you do every day? Probably not. After you do them over and over, they become automatic.

The point is that you do things every day following sequences of steps. Who created these steps that you follow? More than likely, you did, which means that you've been scripting your whole life.

You just never had to write down the steps for your daily routines on a piece of paper before you did them. You could write the steps down if you really wanted to, but it takes too much time and there's no need for it; however, you do in fact know how to. Well, guess what? To write scripts, you only have to make one small change, start writing down the steps, not for yourself but for the world that you're creating in Unity.

So as you can see, you are already familiar with the concept of dealing with scripts. Most beginners of Unity easily learn their way around the Unity interface, how to add assets, and working in the Scene and Hierarchy windows. Their primary fear and roadblock is their false belief that scripting is too hard to learn.

Relax! You now have this book. I am going to get really basic in the early chapters. Call them baby steps if you want, but you will see that scripting for Unity is similar to doing things that you are already doing every day. I'm sure you will have many Aha moments as you learn and overcome your unjustified fears and beliefs.

You have been reading a chapter from
Learning C# 7 By Developing Games with Unity 2017 - Third Edition
Published in: Dec 2017
Publisher: Packt
ISBN-13: 9781788478922
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime