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.
- 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 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.
Despite being a very serious language, Python is full of Easter eggs and hidden references. This post shows the top 5:
- Hello World…
- The Zen of Python
- C-Style braces instead of indentation
- Monthy Python references
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.
- Step 1: The arrays
- Step 2: The shader
- Step 3: The C# code
- Step 4: A more general approach
- Conclusion & download
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
If there’s a term which is often misunderstood, that’s for sure hacking. When it refers to softwares, it usually gets a negative connotation which smells of piracy and copyright infringements. This post will not cover any of these topics; quite the opposite, I strongly discourage readers from taking any action which will damage (directly or indirectly) other developers. That said: yes, this post will be a practical tutorial to hack into Unity games. You can use the techniques and tools described in this post to check how safe your games are. If you’re a developer, you’ll also find useful snippets of code and technique to add an extra layer of protection to your games.