Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

How to execute code after X seconds

$
0
0
Hello. I know this question has been asked before but i couldnt get it to work properly I am new in Unity and really bad at coding so that's why I am asking something so obvious for some people like this... :( I have this code, in my FPS game, that i found on Youtube, where i want to give me ammo every 3 seconds if i come to the area. To specify this area I use a collider box. So i want to have this code executed every 3 seconds when being in the area that i mentioned above.. This is the code: var AmmoPickUpSound : AudioSource; function OnTriggerEnter (col : Collider) { AmmoPickUpSound.Play(); if (GlobalAmmo.LoadedAmmo == 0) { GlobalAmmo.LoadedAmmo += 30; } else { GlobalAmmo.CurrentAmmo += 30; } }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>