Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning C# by Developing Games with Unity 2020
  • Table Of Contents Toc
  • Feedback & Rating feedback
Learning C# by Developing Games with Unity 2020

Learning C# by Developing Games with Unity 2020

By : Harrison Ferrone
4.5 (39)
close
close
Learning C# by Developing Games with Unity 2020

Learning C# by Developing Games with Unity 2020

4.5 (39)
By: Harrison Ferrone

Overview of this book

Over the years, the Learning C# by Developing Games with Unity series has established itself as a popular choice for getting up to speed with C#, a powerful and versatile programming language that can be applied in a wide array of application areas. This book presents a clear path for learning C# programming from the ground up without complex jargon or unclear programming logic, all while building a simple game with Unity. This fifth edition has been updated to introduce modern C# features with the latest version of the Unity game engine, and a new chapter has been added on intermediate collection types. Starting with the basics of software programming and the C# language, you’ll learn the core concepts of programming in C#, including variables, classes, and object-oriented programming. Once you’ve got to grips with C# programming, you’ll enter the world of Unity game development and discover how you can create C# scripts for simple game mechanics. Throughout the book, you’ll gain hands-on experience with programming best practices to help you take your Unity and C# skills to the next level. By the end of this book, you’ll be able to leverage the C# language to build your own real-world Unity game development projects.
Table of Contents (16 chapters)
close
close

Time for action  reaching the treasure

Let's cement this topic with a little treasure chest experiment:

  1. Declare three variables at the top of LearningCurve: pureOfHeart is a bool and should be true; hasSecretIncantation is also a bool and should be false, and rareItem is a string and its value is up to you.
  2. Create a public method with no return value, called OpenTreasureChamber, and call it inside Start.
  3. Inside OpenTreasureChamber, declare an if-else statement to check whether pureOfHeart is true and that rareItem matches the string value you assigned to it.
  4. Create a nested if-else statement inside the first, checking whether hasSecretIncantation is false.
  5. Add debug logs for each if-else case, save, and click on Play:

If you matched the variable values to the preceding screenshot, the nested if statement debug log will be printed out. This means that our code got past the first if statement checking for two conditions...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY