jeudi 27 avril 2023

Random Numbers in Unity 3D?

What I found was how to create random numbers. Great.

This solution, however, was not working in other functions. To create a random number, I used

enter image description here

inside of a function called enemyWalk(){};

However, this caused an error:

enter image description here

This error does not appear when I take the random integer generator out of the function. Any solutions to fix this problem?

I'm hoping to use this code to make my enemy wander around when not doing anything by randomly choosing an integer that decides which direction he walks (up, left, right, or down), then using a random double generator to determine the distance it walks. However I need a random number generated whenever enemyWalk(){}; is called.




Aucun commentaire:

Enregistrer un commentaire