# C# Scripting Tutorials

for the Unity Engine

- Unity, C#, logic, mathematics.
- Insight, control, results.

These tutorials teach you about C# scripting for Unity. The tutorials build on one another, introducing new programming concepts, math, algorithms, and Unity features. They will be useful to you, whether you're brand new to scripting or an experienced developer.

The tutorials are all written, not videos. They are enhanced with plenty of screenshots and diagrams. Recent tutorials also contain short animations.

The tutorials are written by me, Jasper Flick from Catlike Coding.

## Tutorials

### Basics

These tutorials provide an introduction to working with C# in Unity.

# Clock

Build a clock that shows the current time. While doing so, become familiar with the basics of writing C# scripts in Unity.

# Constructing a Fractal

Recursively add chilren to a game object, add some randomization, and you get your own 3D fractal. Use a coroutine to see it grow.

# Frames Per Second

Design a test scene to tank your FPS, then measure it with your own counter.

# Object Pools

Create a fountain of stuff, then feed it with your own object pools.

# Curves and Splines

Start with a line segment, then work your way up to quadratic Beziér curves and splines. All fully editable in the scene view.

### Mesh Basics

An introduction to procedural meshes. From a simple grid to deformable balls.

# Procedural Grid

Create a simple grid of vertices and triangles.

# Rounded Cube

Use your knowledge of grids to build a rounded cube.

# Cube Sphere

Turn a cube mesh into a sphere, then use mathematical reasoning to improve it.

# Mesh Deformation

Take any mesh and turn it into a deformable stress ball.

### Hex Map

A series about hexagon maps. Lots of strategy games use them.

# Creating a Hexagonal Grid

Generate a simple hex grid and support in-game editing of cell colors.

# Blending Cell Colors

Connect cell with each other and blend their colors.

### Noise

Procedural noise is useful for lots of things. The series shows how to make your own.

# Noise

Create a prodedural texture, then fill it with pseudorandom noise. Go from 1D to 3D, generating both Value and Perlin noise.

# Noise Derivatives

Create a procedural mesh, using noise to turn it into a terrain. Then compute analytical noise derivatives and create Curl noise.

# Simplex Noise

Discover how to create alternatives for Perlin and Value noise, based on a simplex grid.

### Marching Squares

A series about drawing and reconstructing shapes using a 2D grid. Why not Marching Cubes? Because the concepts are the same for both 2D and 3D, and dealing with two dimensions is already complex enough.

# Partitioning Space

Build an editable 2D voxel grid, then triangulate it with the Marching Squares algorithm.

# Sharing and Crossing

Add vertex sharing and flexible edge crossings to Marching Squares.

# Staying Sharp

Enhance Marching Squares with Hermite data, then reconstruct sharp features and resolve ambiguous cases.

# Erecting Walls

Refactor Marching Squares a bit, then add walls to give it some depth.

# Being Colorful

Make Marching Squares more colorful by adding support for multiple materials.

### Games

Tutorials that can be considered small games.

# Swirly Pipe

Create a prototype racing game where you move through endlessly twisting pipes.

# Maze

Procedurally fill a rectangular area with a random walk. Add walls, doors, rooms, and other details. Then navigate the maze you have created.

### Older Tutorials

These tutorials are old. They work for Unity 4. I won't update them to Unity 5. They still have value, but you'll likely have to make adjustments yourself.

# Graphs

Visualize mathematical functions using particle systems, and even animate them. Show a 1D line, a 2D grid, and a small 3D voxel system.

# Runner

Create an endless runner game with different platform types and a power-up. Use physics, particle systems, managers, events, and queues.

# Octahedron Sphere

Create an approximation of a sphere by subdividing the faces of an octahedron. This tutorial was commissioned by Binpress.

# Custom Data

Create a custom data type for a colored point, then make it easier to edit by giving it a custom property drawer.

# Custom List

Build an alternative visualization for arrays and list. Then give it a few configuration options.

# Star

Using a list of colored points, create a simple star object by means of a dynamic mesh, which exists in edit mode and is editable in the scene view.

## Questions & Answers

Have a question? Here are a few common ones. Click or touch the questions to see the answers. You can also contact me in various ways.