make a monster randomly move throughout an area every 5 seconds
void Movement() { posX = Random.Range(0, 10); posY = Random.Range(0, 10); posZ = Random.Range(0, 10); } IEnumerator MovementLoop() { while (true) { Movement(); yield return new WaitForSeconds(5); // wait 5 seconds } } void Start() { StartCoroutine(MovementLoop()); }