Iterating over lists in C# is often done using for loops. This tutorial shows how the foreach construct can be coupled with the yield statement to create more elegant and safe code.
This tutorial shows how to extend the class SpriteRenderer to support intuitive, painless fading transitions. Despite referring to sprites, this approach can be used to easily animate any property of a game object in Unity.
- Step 1. Extending the SpriteRenderer
- Step 2. The Coroutine
- Step 3. Invoking the Coroutine
- Step 4. The Callback
The link for the script used in this tutorial is at the end of the post.
This tutorial shows how to automatically generate simplified colliders for 3D models imported into Unity. The tutorial uses Google SketchUp as an example, but its knowledge and code is agnostic to whichever modelling tool you are using.
In a previous post, How To Integrate Arduino With Unity, we have shown how data can be sent and received through the serial port. The main problem encountered was dealing with the latency and the delays that communicating across different devices introduces. The solution proposed in that tutorial used a coroutine; decoupling the device communication from the game logic attenuates the problem, but it doesn’t remove it. The main problem is that, despite the name, Unity coroutines are not really executed in parallel with the rest of the game. Unity, by design, is not thread safe. This means that true parallelism is intentionally avoided by the engine, as it could result in race conditions. To solve the problem of the communication between Unity and Arduino, once and for all, we need actual threads.
- Step 1. Creating the Thread
- Step 2. Callbacks and Queues
- Step 3. Queue Communication
- Step 4. Thread Loop
- Step 5. Improvements
- Conclusion & Download
At the end of this tutorial, you can find a link to download the Unity package.
This tutorial explains how to create custom material inspectors for your shaders in Unity 5.
- Step 1. The Setup
- Step 2. Finding Properties
- Step 3. Toggles
- Step 4. Conditions
This is a tutorial for Unity 5: Unity 4 used MaterialEditor (legacy documentation here) to customise a material’s inspector. That is now deprecated; you should use the new ShaderGUI (documentation here) instead.
Noise is everywhere. Whether you’re sampling accelerometer data for a mobile game or trying to measure the temperature of a room, noise will be there. Even if you could remove all the noise from an input device, you’ll still have a certain degree of uncertainty. If a player has tapped on the screen, where did they really wanted to tap? All these scenarios forces to re-think about how we gather and preprocess data.
This tutorial shows how the manage scenes and levels in Unity 5.3, with the introduction of UnityEngine.SceneManagement.
- Part 1. What’s new in Unity 5.3
- Part 2. Accessing the SceneManager class
- Part 3. Retrieving the current scene
- Part 4. Loading a single scene
- Part 5. Reloading a scene
- Part 6. Issues
This post will show how to simulate cellular automata using shaders. The popular cellular automaton developed by John Conway, Game of Life, will be used as an example for this tutorial. To learn how to set up your project, check out the first two parts of this tutorial: How to Use Shaders For Simulations and How to Simulate Smoke with Shaders.
- Part 1. Conway’s Game of Life
- Part 2. Implementation
- Part 3. Optimisation
- Part 4. Improvements
- Conclusion & Downloads
This tutorial will teach you how to create non euclidean cubes in Unity, giving the illusion that each face is a door onto another dimension. This post is part of a series of tutorials on impossible geometries.
This effect can be seen in many game, most notoriously Antichamber which uses it extensively.
- Step 1. Stencil Theory
- Step 2. The stencil mask
- Step 3. The stencil geometry
- Step 4. Putting all together