Skip to content

MinaPecheux/unity-tutorials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

[Unity/C#] Tutorials

Mina PΓͺcheux - Since November 2022

This repo contains the code and assets for the various Unity/C# tutorials I published as texts/videos on YouTube and Medium (πŸ‡¬πŸ‡§ + πŸ‡«πŸ‡·).


As of now, the repo contains some global assets/settings, and personal libraries (in the Assets/Dependencies/ folder), like:


And in the Assets/ folder, you'll find the code and assets for the following tutorials:

01. Using behaviour trees for a RTS collector AI

Discover how to use the behaviour tree AI design pattern to give some life to RTS collector units! These little trucks will chop down trees or mine ores to gather wood and minerals, auto-finding the closest targets and regularly delivering their resources to a nearby depot, until the entire map is empty...

cover-01_behaviour-trees_rts

02. Creating a day-and-night cycle system

Learn how to setup a basic day-and-night cycle in a 2D scene, by changing the global light and toggling some smaller spots.

cover-02_day-and-night

03. How to use Unity's new input system

Want to learn more about Unity's new InputSystem package, and how you can use it to create basic cross-platform player controller that supports both gamepads and keyboard+mouse layouts? Then check out this quick tutorial :)

Important note: The repo contains an extended version of the HeroController.cs script we make in the YouTube video with additional camera control (you can find it in the HeroControllerWithCamera.cs script). To use it, replace the HeroController component with the HeroControllerWithCamera on the "Hero" object, and then disable the "Aim" feature of the Cinemachine camera, so the script is free to rotate the view as it wants :)

cover-03_new-input-system

04. How to use Unity's Scriptable Objects

Want to learn more about Unity's Scriptable Objects, and how you can use it to store custom data types in an efficient way? Then check out this tutorial :)

cover-04_scriptable-objects

05. Creating a basic field of vision system

Learn how to make a simple field of vision (FOV) system for a robot guard unit with custom debug gizmos for easy visualisation and tweaking, and with related alertness levels.

cover-05_guard-fov

06. The power of custom animation events

Wanna discover how to embed events in your Unity animation clips to precisely time callbacks and trigger specific reactions all throughout the moves of your hero avatars? Check out this quick tutorial! :)

cover-06_animation-events

07. Implementing a basic building placement system

If you want to learn how to make your own RTS-like "free placement" building system, then check out this video tutorial!

cover-07_building-placement

08. Implementing a grid-based building placement system

Wanna extend on our previous "free placement" building system and learn how to turn it into a snapping grid version? Check out this quick tutorial!

cover-08_building-grid-placement

Shaders

Procedural Grid (URP)

Learn how to create a simple procedural grid with adaptive cell size, world-relative coordinates, and customisable colours/transparency.

Edit: @Montesinnos added a really nice improvement to the shader to avoid the offset due to the thickness - it's been merged in Sept, 2023 and is available in the main branch of this repo! :)

cover-shaders_procedural-grid

Cross-platform Wireframe (URP)

Discover the specificities of wireframe shaders, why making them cross-platform is hard, and how to dodge this issue thanks to pre-computed barycentric coordinates.

cover-shaders_crossplatform-wireframe