Tag: unity
-
How to build a distance sensor with Arduino
You can safely say that when it comes to electronics, there are countless ways to measure distances. This tutorial will explain how to build an inexpensive IR distance sensor under $8, perfect for close measurements and motion detectors. You will need: You can download the final Arduino code here. This post is part of a longer series of tutorial about…
-
Impossible Geometry: Non-Euclidean Cubes
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. You can download the Unity package here.
-
How to Write Native Plugins for Unity
Unity has the ability to import pieces of code written (and compiled) in other languages; they are called Native Plugins, and this tutorial will teach you how to build them. Source codes:
-
How to generate Gaussian distributed numbers
In a previous post I’ve introduced the Gaussian distribution and how it is commonly found in the vast majority of natural phenomenon. It can be used to dramatically improve some aspect of your game, such as procedural terrain generation, enemy health and attack power, etc. Despite being so ubiquitous, very few gaming frameworks offer functions to generate numbers which follow…
-
A practical tutorial to hack (and protect) Unity games
—
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:…
-
Console debugging in Unity made easy
One of the most interesting feature of Unity is the ability to extend its editor and standard components. This has allowed developers all around the world to create amazing extensions which dramatically improve Unity’s usability. And, in some cases, compensate for its shortages. A very intriguing feature which is not-so-well known is the ability to customise the messages in…
-
Extension methods in C#
—
Following the heritage of C++, C# comes with a number of powerful features which can either be used to massively improve your code …or to make it completely unreadable. In this post we’ll discuss a technique to add new methods to already existing classes. Yes, even classes you don’t have access to such as Vector3, Rigidbody and even string. Let’s introduce extension methods with…
-
Enum, Flags and bitwise operators
—
If you’re a game developer chances are you’re familiar with the need to describe different variations of an attribute. Whether it’s the type of an attack (melee, ice, fire, poison, …) or the state of an enemy AI (idle, alerted, chasing, attacking, resting, …) you can’t escape this. The most naive way of implementing this is…
-
How to Snap to Grid in Unity3D
—
Despite Unity3D being such an advanced framework, I am sometimes puzzled by its lack of basic features. Especially when working with 2D games, the lack of a proper snap to grid option is simply crazy. Luckily, Unity3D allows to extend its basic interface to add new behaviours. This post will explain how to add a customisable snap to grid option…
-
Screen shaders and image effects in Unity3D
—
Part 1, Part 2, Part 3, Part 4, Part 5, [download the Unity3D package] If you are using Unity3D you may be familiar with image effects. They are scripts which, once attached to a camera, alter its rendering output. Despite being presented as standard C# scripts, the actual computation is done using shaders. So far, materials have been applied…