Posted on

How to Make a Random Binary Path in Unity

In this video, I show you how to create and code a random binary path which I use for our ZigZag tutorial series. A random binary path is an infinitely generating path that randomly changes directions between two directions.

In this video, I only show you how to create the initial segments of the starting platform. For this tutorial, we will talk about for loops, if statements, instantiation, and the random range function.

Posted on

Random Range Not Working in Unity

If you are ever trying to get a random number between 0 and 1 in Unity and end up only ever getting 0 then this might be your problem and solution. One thing you might not know about Random Range function in Unity is that the second parameter needs be plus one greater than the top number you wish to have for random pick when using ints.

The reason for this is that the Random Range function normally uses float and like when you case afloat into an int, whatever decimal numbers you have will be removed never rounding up.