Quantcast
Channel: Answers by "TheCatProblem"
Viewing all articles
Browse latest Browse all 28

Answer by TheCatProblem

$
0
0
The upper bound of `Random.Range()` is exclusive (i.e., it will never be selected). Thus `Random.Range(0, 1)` will always return 0. See [the documentation][1] for more details. You could instead use `var randomNumber = Random.Range(0.0f,1.0f)` and check if `randomNumber` is less than `0.5f` (which it should be roughly 50% of the time) instead of checking if it equals 0 or 1. [1]: http://docs.unity3d.com/ScriptReference/Random.Range.html

Viewing all articles
Browse latest Browse all 28

Latest Images

Trending Articles





Latest Images