This is the Complete Unity C# Developer 3D, the long-awaited sequel to the Complete Unity C# Developer 2D - one of the most successful e-learning courses on the internet! Completely re-worked from scratch with brand-new projects, our latest teaching techniques,. You will benefit from the fact we have already taught over 350,000 students game development, many shipping commercial games as a result.
You're welcome to download, fork or do whatever else legal with all the files! The real value is in our huge, high-quality online tutorials that accompany this repo. You can check out the course here: Complete Unity C# Developer 3D
This is a 3D isometric tech demo designed to teach the fundamentals of AI pathfinding, namely Breadth First Search or BFS. (Section REF: RR_CU2)
This is a Unity project. If you're familiar with source control, then "clone this repo". Otherwise download the contents, and navigate to Assets > Levels
then open any .unity
file.
This branch is the course branch, each commit corresponds to a lecture in the course. The current state is our latest progress.
Here are the lectures of the course for this section...
In this video (objectives)…
- How this project fits into the course.
- A peek at what we'll be building.
- Why not use Unity's built-in pathfinding.
- You'll learn C# co-routines,
Queue
,Dictionary
. - Order independent execution, editor scripts and more in Unity.
After watching (learning outcomes)…
Explain to a fellow student roughly what we're building, and why this is awesome stuff to know.
In this video (objectives)…
- A quick overview of Unity's NavMesh.
- How our system compares.
After watching (learning outcomes)…
Explain why we are creating pathfinding from scratch.
In this video (objectives)…
- Demonstrate z-fighting problem.
- Show quads as building blocks.
- Demonstrate back face culling.
- Create labelled block prefab.
After watching (learning outcomes)…
Build simple objects from cubes, and describe both back face culling, and z-fighting.
### 4 ExecuteInEditMode Attribute ###
In this video (objectives)…
- Why we want snapping in our world.
- How to use Unity's snap feature.
- The limitations and why we write our own.
- Introducing
[ExecuteInEditMode]
attribute. - Introducing
[Range()]
attribute.
After watching (learning outcomes)…
Enforce snapping in the Unity editor using an "editor script".
### 5 Using Text Mesh For Labels ###
In this video (objectives)…
- How to use Text Mesh in Unity
- Text Mesh vs UI Text
- Using the
[SelectionBase]
attribute - Using 'GetComponentInChildren()'
After watching (learning outcomes)…
Use Text Mesh to label objects in the world for debug.
In this video (objectives)…
- The
List<>
syntax - Lists vs arrays
- Creating a custom waypoint path.
After watching (learning outcomes)…
Use a simple list in C#.
In this video (objectives)…
- How loops stall of block our code
- Use 'IEnumerator' as a return type
- Using 'StartCoroutine()'
- How to 'yield' execution
- Returning a yield instruction
- Using 'WaitForSeconds()'
After watching (learning outcomes)…
Use a basic co-routing to make a time-based sequence appear to run in parallel to the rest of your game code.
In this video (objectives)…
- Look at Breadth First Search (BFS)
- Compared to Dijkstra's algorithm and A*
- Why A-Star isn't always the best best
After watching (learning outcomes)…
Discuss the basic differences between three pathfinding algorithms.
Ben explains what to expect in the next two videos.
In this video (objectives)…
- Used
const
forgridSize
global data - Discussed dependencies
- Refactored our code.
After watching (learning outcomes)…
Move information from one class to another, and use const
where appropriate.
In this video (objectives)…
- Setup our first C# dictionary for our grid
- Syntax:
Dictionary<Vector2Int, Waypoint> grid
- Use
grid.Add()
to add elements - Use
grid.ContainsKey(gridPos))
to detect duplicates.
After watching (learning outcomes)…
Recognise (but not necessarily use), basic C# dictionaries.
In this video (objectives)…
- Discuss how to find a child object from a script
- Use
transform.Find()
to find by name - Color our blocks with
waypoint.SetTopColor()
After watching (learning outcomes)…
Find other game objects by their name.
In this video (objectives)…
- See how
+
can join strings, and add vectors. - Use
try {} catch {}
to catch errors.
After watching (learning outcomes)…
Specify a list of allowable directions and "explore" in them.
In this video (objectives)…
- Look at the Wikipedia article on BFS
- Demonstrate simpler pseudocode for BFS
- Walk through BFS step-by-step.
After watching (learning outcomes)…
Manually perform Breadth First Search, and find the shortest path.
In this video (objectives)…
- Define FIFO vs LIFO queues
- Using
Queue<Type> queue
syntax - Using
Queue.Enqueue()
- Using
Queue.Dequeue()
- Detecting when end waypoint is found.
After watching (learning outcomes)…
Add and remove items from a C# queue.
In this video (objectives)…
- Use our
isRunning
state - Log out what we're queueing
- Check pathfinding across whole grid.
After watching (learning outcomes)…
Use systematic manual testing to help write software.
In this video (objectives)…
- Thanks to Eddie for spotting an improvement
- Using
queue.Contains(neighbour)
to prevent duplicates - Improving our color architecture
- Justifying the use of
public
vs[SerializeField]
- Leave a breadcrumb.
After watching (learning outcomes)…
Explain why you would sometimes use public
In this video (objectives)…
- Create our list
- Adjust our architecture
- Hand over to Rick
After watching (learning outcomes)…
Manipulate C# lists, and create getter methods.
In this video (objectives)…
- Import art assets
- Reconstruct our pathfinding block with the new look
- Update the rest of our scene with a new look
After watching (learning outcomes)…
Import, implement and tune art assets for your scene.
In this video (objectives)…
- Construct a tower with base and top parts.
- Use LookAt to move the top of the tower to look at a moving enemy.
After watching (learning outcomes)…
Use LookAt statement to control the rotation of a tower.
In this video (objectives)…
- Where to find additional content for creating MagicaVoxel assets.
- What content we will cover in our MagicaVoxel community course.
After watching (learning outcomes)…
Aware of the MagicaVoxel Bonus Content.
In this video (objectives)…
- Understand our remaining feature set for Realm Rush.
- Overview of the process for shooting and damaging enemies.
After watching (learning outcomes)…
Ready to take on another big solo challenge.
In this video (objectives)…
- Attach a bullet particle effect to the towers.
- Create EnemyDamage script that recognises bullet collision.
- Organise enemy's hierarchical structure to properly recognise collision.
After watching (learning outcomes)…
Create tower bullets which successfully collide with enemy.
In this video (objectives)…
- Decrease enemy hitpoints when enemy is hit.
- Destroy enemy when hitpoints are below 1.
After watching (learning outcomes)…
Implement enemy hitpoint and kill enemies.
In this video (objectives)…
- Create a condition where towers only shoot if enemy is within range.
- Implement Vector3.Distance to determine distance from towers to enemies.
- Turn on and off particle emission system if there is no valid enemy.
After watching (learning outcomes)…
Create a condition where towers only shoot if enemies are close enough.
In this video (objectives)…
- Instantiate an enemy Manually
- Resolve the root cause of the errors
- Modify 'Pathfinder.cs' to "cache" path
- Drone one about caching and naming again.
After watching (learning outcomes)…
Resolve issues with instantiating at runtime by practicing in Unity's Play mode.
In this video (objectives)…
- Show how to search our GitHub pages
- Explain spawning architecture
- Setup a spawning coroutine.
After watching (learning outcomes)…
Create a simple co-routine from scratch on your own. Remember "Blooms Taxonomy"
In this video (objectives)…
- Revise instantiating
- Challenge you to add audio to the game now
- Modify
Tower.cs
to find closest enemy - Challenge you to write
Transform GetClosest(Transform b, Transform b)
After watching (learning outcomes)…
Find the closest of two transforms.
In this video (objectives)…
- Introduce Unity's
OnMouseOver()
message - Show you how to troubleshoot message issues
- Log out which block our mouse is over.
After watching (learning outcomes)…
Use Unity's built-in messages, and troubleshoot them from docs when not working.
In this video (objectives)…
- Recap our design decisions for
Waypoint.cs
- Add the ability to flag a block as "placeable"
- Use version control to find a bug we introduced
- Differentiate between valid and invalid tower clicks.
After watching (learning outcomes)…
How to filter click input based on data about what's being clicked-on.
In this video (objectives)…
- Explain the basics of Bloom's Taxonomy again
- Challenge to complete the tower placement.
After watching (learning outcomes)…
Combine your knowledge of [SerializeField]
and Instantiate()
in one exercise.
In this video (objectives)…
- Fix a minor bug in our pathfinding algorithm
- Add cool jet booster particles to our enemy
- Add hit and death particle effects.
After watching (learning outcomes)…
Use particles effects two different ways, either referring to a prefab on the same game object, or a separate asset.
In this video (objectives)…
- Note we've changed to Unity 2017.3.1
- Introduce a new mnemonic
www.wow
- Overview ring or circular buffers
- Briefly discuss performance and memory fragmentation.
After watching (learning outcomes)…
Explain in simple terms what a ring buffer is.
In this video (objectives)…
- Create a Tower Factory class
- Move the tower prefab, and max towers there
- Introduce
this
in C# - Wire-up our tower factory, at least in outline.
After watching (learning outcomes)…
Use the this
keyword to pass instances around.
In this video (objectives)…
- Discuss using a C# queue for a ring buffer
- Practice pseudo coding
- Get the queue managing its self.
After watching (learning outcomes)…
Implement simple C# queues from scratch.
In this video (objectives)…
- Finish our ring buffer
- Discuss how to destroy particle systems
- Use Unity's
Destory(object, delay)
function
After watching (learning outcomes)…
Destroy instantiated particle effects when they have finished playing.
In this video (objectives)…
- Speed up enemy movement
- Destroy enemies when they reach the end of their path
- Trigger enemy goal particles
After watching (learning outcomes)…
Explode enemies after they have completed their path.
In this video (objectives)…
- Increase the size of our level
- Create a mechanism to decrease player health when enemy reaches base
After watching (learning outcomes)…
Create a simple collision-based health system for the player's base.
In this video (objectives)…
- Add text fields to canvas UI for player health and score
- Connect the player health code to the UI text
- Increase score whenever new enemy is spawned
- Connect score value to score text
After watching (learning outcomes)…
Create updating UI text elements for the gameplay values of score and health.
In this video (objectives)…
- Import the Unity Post Processing Stack
- Set up profile asset
- Modify post processing aspects such as bloom, vignette and color grading
After watching (learning outcomes)…
Implement Unity Post Processing Stack to create a unique look for your game.
In this video (objectives)…
- Asset our sound design needs
- Trigger SFX for spawning, base damage and enemy damage
- Add music to the game
After watching (learning outcomes)…
Implement sound effects for key moments in the game.
In this video (objectives)…
- Implement the PlayClipAtPoint() method to ensure our audio clip is played even if our GameObject is destroyed.
- Investigate Unity's audio setup to discovery why our audio clip is played at lower volume.
- Discuss 2D versus 3D spatial sounds in Unity.
- Implement audio track.
After watching (learning outcomes)…
Create sound effects that persist even if the parent GameObject is destroyed.
In this video (objectives)…
- Looking at all the design levers available.
- Understanding your intention, and how you can execute on that.
- Finding the fun for a 2 minute game moment.
- Share!
After watching (learning outcomes)…
Understand what levers to pull in order to make your game moment compelling.
In this video (objectives)…
- Recap of the key new concepts we've covered in this section.
- What to expect in the next section of the course.
After watching (learning outcomes)…
You'll be fired up to continue your learning journey!