
This tutorial shows how to make the most out of coroutines in Unity.
- Introduction
- Part 1. Synchronous Waits
- Part 2. Asynchronous Coroutines
- Part 3. Synchronous Coroutines
- Part 4. Parallel Coroutines
- Conclusion
There are 32 posts filed in Programming (this is page 2 of 4).
This tutorial shows how to make the most out of coroutines in Unity.
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.
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.
At the end of this tutorial, you can find a link to download the Unity package.
This post shows how to use arrays and shaders in Unity 5.4. Back in January I already covered this topic in an article called Arrays & shaders: Heatmaps in Unity. My original approach exposed an undocumented feature that allowed to pass arrays to shaders. Since then, Unity 5.4 has introduced proper support in its API. This tutorial replaces the previous article. If you have read the previous tutorial, you do not need any changes to your shader code and you can skip to Step 2.
The previous post in this series, Understanding Deep Dreams, explained what deep dreams are, and what they can be used for. In this second post you’ll learn how to create them, with a step by step guide.
Despite being a very serious language, Python is full of Easter eggs and hidden references. This post shows the top 5:
I have covered the 5 most interesting features of Python in this post. Continue reading
This tutorial explains how to create C++ libraries in Arduino.
This tutorial explains how to pass arrays to shaders in Unity. This feature has been present for a long time, but is mostly undocumented. Unity 5.4.0 Beta 1 will introduce a proper API to pass arrays to shaders; this technique however will work with any previous version.
If you are using Unity 5.4+, please refer to the Arrays & Shaders in Unity 5.4+ tutorial.
Python aims to be an elegant and expressive language; this post includes its top 5 hidden features:
The term hidden is loosely used to indicate features which are generally unique to Python, or not very well known. I covered the most interesting Easter eggs which are really hidden in Python in this post. Continue reading
Having worked both as a teacher and an artist, I know how important data visualisation is. This tutorial will teach you to create interactive network graphs with Python and JavaScript. You can have a go by dragging the nodes of the graph below…
You can find a high resolution version of the melancoil tree (2000x2000px, first 1000 numbers) here: PNG, SVG, HTML. Continue reading