Category: C#

  • Iterators in C#: yield, IEnumerable & IEnumerator

    Iterators in C#: yield, IEnumerable & IEnumerator

    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.

  • Fading Sprites in Unity

    Fading Sprites in Unity

    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. The link for the script used in this tutorial is at the end of the post.

  • Simplified Collision Geometry

    Simplified Collision Geometry

    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.

  • Asynchronous Serial Communication

    Asynchronous Serial Communication

    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…

  • ShaderGUI: Custom Material Inspectors in Unity

    ShaderGUI: Custom Material Inspectors in Unity

    This tutorial explains how to create custom material inspectors for your shaders in Unity 5. 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.

  • An Introduction to Signal Smoothing

    An Introduction to Signal Smoothing

    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…

  • Implementing a Loading Bar in Unity

    Implementing a Loading Bar in Unity

    This tutorial will explain how to create a loading bar in Unity. This is the second part of a longer series on scene management.

  • Scene Management in Unity 5

    Scene Management in Unity 5

    This tutorial shows how the manage scenes and levels in Unity 5.3, with the introduction of UnityEngine.SceneManagement.

  • How to Simulate Cellular Automata with Shaders

    How to Simulate Cellular Automata with Shaders

    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.

  • How to integrate Arduino with Unity

    How to integrate Arduino with Unity

    In this tutorial you will learn how Unity and Arduino can communicate using the serial port. This tutorial requires both C# and Arduino scripts; the labels  Unity  and  Arduino  will be used to avoid confusion. The topic of connecting Arduino to Unity is further expanded in Asynchronous Serial Communication, where you can also download the entire Unity package.