
Explore fundamentals of C# and Unity in a one-stop survival guide, from basics to advanced workflows. Learn lists, dictionaries, delegates, events, lambdas, and LINQ to accelerate your Unity scripting career.
Use the Unity C# survival guide as a practical tool to reinforce learning, refresh delegates and events, complete how tos and challenges, and confidently implement solutions in professional game development.
Install Unity Hub to download the latest Unity editor and manage multiple versions across projects. Follow prompts to install, accept terms, and select build supports such as Android or iOS.
Enable Unity collaborate, create an organization, and publish a 3D project to the cloud for team access. Add members via Unity teams and manage seats.
Learn to change a gameobject's position by using transform.position with a vector3, snapping the player to 0,0,0 at start, or via a public startPosition set in the inspector.
Explore checking keyboard input in Unity via the update method, using the input class and key codes with get key down, get key, and get key up to print messages.
Build a simple movement system in Unity by translating the player with the transform, driven by horizontal input from the input manager, and smoothed with Time.deltaTime at a configurable speed.
create a collectible cube with a green material, enable a non-gravity rigidbody as isTrigger, and use on trigger enter to check other.tag equals 'player' and destroy it.
Implement a pause system in Unity using timescale. Press space to pause, press a key to resume, and experiment with slow motion by setting timescale to 0.5.
Explore the post-processing stack v2 to apply cinematic filters to the main camera, like Photoshop for games, with a global volume and tweaks to bloom, color grading, and tone mapping.
Demonstrate creating a destructible crate in Unity by swapping a solid crate for a fractured version, wiring physics, colliders, rigid bodies, and an explosion force to simulate breaking.
Learn how Unity handles rotations using quaternions under the hood and why Euler angles are used for readability, plus how to avoid gimbel lock by using quaternions.
Learn how quaternion identity and Quaternion.Euler rotations define object orientation, and spawn a cube at the origin with a 35-degree y-axis rotation.
Explore Quaternion.LookRotation in Unity by calculating direction as destination minus source, and rotate a mech to face a sphere. Visualize the direction with a debug draw ray.
Learn how quaternion slerp provides smooth rotation from the current rotation to the target look rotation, instead of snapping, by interpolating over time using delta time.
Explore creating a Unity C# script from scratch by naming the file, matching the class, and inheriting MonoBehaviour to access Start and Update.
Explore how variables in Unity store game data as public or private boxes, define data types like string, int, float, and bool, and expose initial values in the inspector.
Explore common data types in C# and Unity, from strings and numbers to game objects, transforms, and animators, and learn how to declare variables and reference components in scripts.
Declare and initialize common Unity C# variables such as name, age, speed, health, score, hasAllKeys, and ammo, and log them with debug.log.
Create a c sharp script to define an item class with name, description, image icon, and attack strength, using sprites for the image and exposing variables in the inspector.
Define an item class with properties: name, description, icon (sprite), and attack strength (float). Use the inspector to set values and print them with debug logs.
Create a tip calculator in a new C# script. Define bill, tip, and total variables, compute the total, and print your bill and tip amounts.
Create a Unity tip calculator using public bill and tip variables, convert tip to a percentage, compute total amount, and explore local versus global scope.
Create a C# quiz calculator script that generates five random quiz grades at runtime in Unity, stores them in quiz1 through quiz5, computes their average, and prints it.
Learn to implement a Unity quiz calculator by declaring five public float quiz variables, assigning random values with Random.Range, computing average, rounding to two decimals, and attaching script to camera.
Use underscore prefixes to denote private variables and decide public vs private access based on script collaboration, keeping private stats and equipment inaccessible while public names are shared.
Explore more challenges at Game Dev HQ in the education section, where free Unity challenges let you select, download a package, and solve problems, with discussion threads for help.
Learn how if statements control Unity C# game logic with conditions and variables, including else branches, driving-age examples, and converting pseudocode to code.
Create a Unity program that increments the points variable by 10 each time the space key is pressed, using an if statement to detect input.
Implement a points variable in Unity, update it with the space key using get key down, then expose it in the inspector with serialized field so you can see it.
Master if statements by creating a condition that prints a message when points reach 50. Use pseudocode to implement a conditional that outputs you're awesome at the threshold.
Master if statements in Unity C# by triggering a debug log when points reach 50, test with the space key, and understand repetitive prints from the update loop.
Master if statements in Unity using a boolean flag to print a one-time message when points reach 50, combining conditions with && and || in the update loop.
Master if statements by using a boolean flag to print a debug log only once when points reach 50, then assign true to has message been sent.
Define difficulty levels as variables and use an else-if ladder to handle the current selection with debug messages. Cover easy, medium, hard choices and a default invalid level path.
In the Unity C# Survival Guide course, this lecture has you create a five-quiz grade calculator, compute the average, and print A, B, C, or F grade with if-else logic.
Compute the average of five public float quiz grades in Unity, assigning values via inspector or random range, then use if-else with PEMDAS to log the letter grade A–F.
Place a cube at the origin, start it red, and press space to increment a score; when it exceeds 50, turn the cube blue via a public game object reference.
Increment the score with the space key and turn the cube from red to green when the score exceeds 50, using get component to access the renderer and material color.
Build a speed control in Unity that increments and decrements speed, logs 'slow down' when speed exceeds 20, and 'you need to speed up' at zero, preventing going below zero.
Implement Unity speed controller: increment speed with s and a keys, clamp at zero, warn to slow down above 20, and prompt to speed up at zero with simple ifs.
Access free challenges for all skill levels on Game Dev HQ. Select a challenge, download a Unity package, and solve the problem, with a dedicated discussion thread for help.
Explore how switch statements clean up messy else-if chains in Unity C# by mapping a selected level to easy, medium, or hard, with a default for invalid selections.
Practice converting an if-else points program in Unity C# to a switch statement, using q and w to set 50 or 100, and e to reset with debug messages.
Convert an if-else chain into a switch statement to handle points values of 50 and 100, with a default message and break after each case for Unity C#.
Apply switch statements in Unity C# to change a cube's material color based on user key presses, by accessing the cube's mesh renderer and updating its color.
Learn to use a switch statement in Unity C# to color a cube from keyboard input. Detect keys 1–4, update the next color, and apply it via the cube's renderer.
Map weapon IDs to names, assign them in the inspector, and use a switch statement to display the selected weapon in a Unity C# survival game.
Use a switch statement to map weapon I.D. values to names (gun, knife, machine gun) and display results in Unity's console, including a default case for invalid weapon.
Access free challenges in the education section on game dev HQ, download unity packages, and solve problems, with dedicated discussion threads for help if you get stuck.
Discover how to use a for loop in C# to print John a hundred times, using an index i from zero to max with i++.
Explore how to reverse a for loop to count down from 100, print even or odd numbers using the modulus operator, and iterate arrays with for loops and if statements.
Break out of loops using the break keyword to exit a loop early in Unity C#, demonstrated with a 0 to 100 loop stopping at 50 for responsive game logic.
Explore how for loops run in Unity using coroutines and yield return wait for seconds to increment the apples counter from 0 to 100, with wait times and inspector updates.
Use for loops to iterate through game elements like monsters, items, and objects, applying effects from blasts and shattering fragments, validating inventory additions, and turning all scene objects red.
Explore the C# for each loop, a unique syntax for iterating through arrays and collections with the same concept as a for loop.
Explore the do loop in Unity C# and understand its syntax: do { code } while (condition), and see how it runs the code at least once.
Explore how the while loop works in Unity, including while true infinite loops, and learn to breathe the program by adding increments or waits, like spawning enemies every second.
Create a program that prints 0 through 10, then prints even numbers to 20 and odd numbers to 30, using the modulus operator, for the Unity C# survival guide.
Build a for loop in unity c# that prints 0 through 10, then use modulus operator to print even numbers above nine, and extend to odd numbers up to 30.
Unity c# survival guide: increment speed by five every second until it exceeds a random max speed between 60 and 120, using a while loop with a break.
Review how to implement a Unity C# speed challenge: randomize max speed between 60 and 120, then increment speed by 5 every second until it exceeds max.
Explore free Unity challenges at Game Dev HQ. Select a challenge, download a Unity package, solve the problem, and discuss solutions in dedicated threads.
Learn how to use arrays in Unity C# to store multiple strings or numbers, including three declaration methods, inspector vs code initialization, and runtime considerations.
Access array elements in Unity using subscript indexing and the names, ages, and items arrays. Print values with Debug.Log and prepare for for each loops in future lessons.
Practice creating and accessing arrays of names, ages, and car models, then print last name, last age, and last kid's favorite car; optionally handle space key input to trigger prints.
Practice with arrays in Unity C# by creating five string arrays for names, ages, and cars, then print Corey's name, age, and Mazda on space key press.
Randomly pick a person from five, then print that person's name, age, and vehicle together to demonstrate choosing and displaying linked data.
Trigger a random index from 0 to the array length minus one and print the corresponding name, age, and car from parallel arrays when you press space.
Iterate an array with a for loop to print item IDs and names using the array's length and debug logs, and filter by specific IDs or names.
Demonstrates the for each loop in Unity C# to iterate arrays and print items with a debug log. Shows cleaner syntax and using var or types like string and int.
Create a serialized item class with id, name, and description, and build item database in Unity. Compare foreach and for loops to print names and check item existence by id.
Use an array of cubes in Unity and loop through them with for or foreach to access their mesh render and turn them red when the space key is pressed.
Experiment with a Unity C# array of cubes to respond to the space key by iterating over each cube and setting its color to red using a for loop.
Convert this foreach to a for loop in Unity C#, iterating the cubes array from zero to length. Set each cube's mesh renderer material color to red.
Discover free Unity challenges for all skill levels on Game Dev HQ, download a Unity package, and solve problems with a dedicated discussion thread for each challenge.
Explore how functions and methods in C# are interchangeable in Unity, using void Start and void Update, and learn to create private or public methods for script communication.
Organize code in modular methods to handle attacks, power up, and damage by passing parameters, showcasing health management, input-driven updates, and Pascal vs camel casing in Unity C#.
Pass a cube object in inspector to a function called change color that takes object and color, and ensure the player class sits on the main camera with attached scripts.
drag the cube into the inspector reference, press space to trigger change color, and set the cube's mesh renderer material color to blue using the public game object parameter.
Discover return type functions in Unity C# and see how they return a value like A plus B. Compare with void functions and learn how to assign totals to variables.
this lecture demonstrates four ways to change a unity game object's position, using transform.position, a custom change position function, and a return-type get position method with vector3 inputs.
Build a Unity C# health system that damages the player by a random amount on space, prints player has died message, clamps health to zero, and stops damage after death.
Implement a Unity C# health system that damages the player by a random amount (5–20) on space key press, tracks death, and prevents damage after health reaches zero.
Demonstrates Unity C# survival guide workflow: return all game objects tagged as players into an array with a custom method, then apply random colors via their mesh renderers.
Create an array of five Vector3 positions and a custom method to generate a random index, then spawn the player's cube at that position at startup.
Create a public vector3 array of five positions and fill it in the inspector. Use a custom random index method to set transform.position via getPosition(randomIndex).
Explore more free Unity challenges at Game Dev HQ under education, download a Unity package, solve the problem, and join discussion threads if you get stuck.
Learn object oriented programming in Unity by organizing player and laser logic into separate classes, using model behaviors and non mono behavior classes for clean, maintainable, debuggable code.
Learn how to create custom weapon stats classes in Unity C#, define properties like name, fire rate, and ammo, and use constructors to instantiate and display them in the UI.
Define a custom item class with name, id, and description, and build a serialized RPG item database as a Unity MonoBehaviour using an inspector-friendly array of items.
Define a customer class with first name, last name, age, gender, and occupation, and build a Unity customer database. Create three customers via code and enable inspector input for more.
Define a customer class with first name, last name, age, gender, and occupation, build a customer database, and populate data via constructor and inspector in Unity.
Discover why to use a single custom class to represent items, power ups, and courses, instead of dozens of scripts. Leverage shared attributes and constructors to create instances efficiently.
Build a reusable Unity RPG spell system with a Spell class (name, level, item id, xp gained) and a Wizard that casts Fire Blast and Ice Blast by level.
Explains class inheritance by deriving weapon and consumable subtypes from a base item, sharing core traits like name, id, and icon while adding weapon attack bonuses and health.
Build a modular Unity bank system by defining a base bank with name, location, and cash in vaults, plus core actions, then extend with a lending federal credit union.
Learn how protected data members restrict access to derived classes, enabling base class data to be accessed only by inheritance, with bank and credit union examples.
Explore inheritance through a pet system by using a base pet class and derived duck and dog classes. Learn to override the speak method with protected virtual and public override signatures and call base implementations.
Assess whether to use MonoBehavior or custom classes to define blueprints for your programs. Model behaviors suit pets, enemies, and guns by sharing traits, while items remain simple collections.
Explore value types and reference types in C# by comparing structs and classes. Learn how memory is managed on the stack and heap and how copying occurs during method calls.
Explore more challenges from Game Dev HQ to sharpen your Unity skills, download a Unity package, and solve problems with discussion threads for each challenge.
Discover how static types use the static keyword to store data for the life of the program and access it via the class, illustrated by a score updated on space.
Understand the difference between instance members and static members in C# with item and player examples, showing how static data is shared and constructors update counts.
Demonstrate static types by implementing an enemy spawn manager that spawns and destroys enemies, updates an on-screen count via a UI manager and a prefab.
Implement a static utility helper class in Unity C# with static methods to create objects and set their positions, using a sample player script driven by space and E inputs.
Create a helper class that applies a color to any object you pass to it, test a player behavior that triggers on the space key, and optionally randomize the color.
Create a static helper class with a change color method that sets a game object's material color to a specified value, optionally randomizing color on space key presses.
Learn how static constructors initialize shared static data before instances. Use an employee example with a static company field to illustrate execution order: static constructor runs once, then instance constructors.
Access free, skill-friendly Unity challenges at Game Dev HQ education; select, download a Unity package, and solve problems with discussion threads for help.
This course is authorized by and made in partnership with Unity Technologies.
Have you been struggling to learn how to code in C# with Unity? If so, you have found the course you’ve been searching for! This course is designed for beginner to advanced or professional programmers alike. For beginners, sequential completion of the lessons is recommended, as it will teach you the basics of coding using interactive challenges and problem solving techniques. The course progresses in difficulty, and upon completion, you will have gone from a novice C# developer to an advanced, job ready, C# developer. For advanced or professional coders, this course is meant as a reference guide to help you survive in the workplace. Rusty on delegates and events? Check out the section of this course that focuses exclusively on them, and teaches you how to implement them into your projects. For seasoned coders, sequential progression through the course is not necessary; The Unity C# Survival Guide is flexible, allowing developers to use it for their specific needs. New content is frequently added, so you can rest assured that your survival guide is always up to date. This is the only C# in Unity programming course authorized by and made in partnership with Unity Technologies.
In This Course, You Will:
Master C# with Unity
Become a career-ready programmer in C#
Implement advanced coding logic into your own projects
Discover game programming patterns
Proficiency in abstract classes and interfaces
Learn best practice implementations
Practice typical job interview questions that programmers commonly face
And much more!
This course will take you through over 50 interactive challenges, designed to help you master beginner to advanced C# concepts. The first section, created for novice C# developers, covers variables, “if” statements, loops, and arrays.
The second section focuses on intermediate concepts, like properties, name spaces, enums, and dictionaries.
The third section focuses on advanced concepts, like abstract classes, delegates and events, lambda expression, and linq. This section ends with interview practice problems, compiled from industry professionals who work for Cartoon Network, American Gaming Systems, Facebook, Oculus and more!
In addition to the sections organized by difficulty, there is also a “Unity Quick Tips” section, dedicated on how to do anything in Unity, such as creating character controllers, explosion effects, and how to fire a weapon. The quick tips section also includes a Unity Editor overview, to help beginners get accustomed to Unity, and/or help seasoned developers learn about new features in Unity as Unity updates the editor. If you’re looking for a “how to” section, this is a great place to start.
If there is something in the Survival Guide that is not covered, please send us a message, and we will add it to the course!
Why Learn C# with Unity?
We are entering a revolutionary period in Technology and at the front is Unity Technologies. Unity is no longer just a game engine, but a complete real time rendering platform that’s powering applications within the fields of games, AI, automotive, film, architecture, construction, sales & services, marketing & training, medical, and so much more. The games industry is $120B. Now consider how all these new emerging markets are adopting Unity into their workflows and that number quickly jumps to a trillion dollar marketplace for C# developers. Not convinced? In 2018, companies like Coca-Cola, AT&T, GE, Facebook, Google, Uber, Nissan, Lexus, Tesla, Deepmind, AGS, Disney and many other large corporations adopted Unity into their workflows.
If you’re serious about a career with with C# and Unity, I will help you reach your goals. I’ll see you inside the course.