Quantcast
Channel: Answers by "Howey-Do-It"
Viewing all articles
Browse latest Browse all 12

Answer by Howey-Do-It

$
0
0
"if(Time.time = lastFire + interval; } // This is the Invoke test void InvokeTest() { if(canFire) { canFire = false; shotsFired ++; Invoke ("invoke", interval); } } void invoke() { canFire = true; } // This is the Coroutine test void CoroutineTest() { if(canFire) { canFire = false; shotsFired ++; StartCoroutine(Wait(interval)); } } IEnumerator Wait(float waitTime) { yield return new WaitForSeconds(waitTime); canFire = true; } } Results: The FixedUpdate method appears to be the only one that works independent of the framerate. However, that creates another issue, which is that FixedUpdate tends to completely miss Input sometimes. Is there a solution for that problem? I do want it to fire exactly when the player presses the fire button. Thanks again, I really appreciate all of your responses.

Viewing all articles
Browse latest Browse all 12

Latest Images

Trending Articles





Latest Images