I’m a little stumped as to how Random works behind the curtains. My script sets the same value ( int 1) to direction every time its called. The if Random.Range(0,100) works just fine. I’ve considered breaking the script into 2 parts (one for left one for right) instead of pulling it all under that if, but I could still use a bit of an explanation as to why this is happening. Mahalo
if (Random.Range(0, 100) == 1)
{
direction = 0;
direction = Random.Range(1, 2);
if (direction == 2) direction = -1;
Debug.Log(direction);
speed = Random.Range(0.1f, 0.2f);
DestroyOldBody();
CreateNewBody();
}