- Home /
InvokeRepeating does not work in UNET
Well I am making a multiplayer 2D space shooter game and the player is supposed to shoot at a fixed rate when the screen is touched/held. It worked normally but when I began converting the game to multiplayer, the CmdShoot method does not work. (although it works without the invokeRepeat).. I tried to use coroutine but it said Command methods cannot be coroutines... so how should i shoot at a fixed rate then?
"does not work" as in when the client shoots, I cannot see it in the host screen if I use InvokeRepeating
InvokeRepeating will work in UNET, but there are a few pieces that need to be setup properly in order to properly spawn the projectiles on all clients. Can you attach your projectile creation script?
Answer by seanr · Aug 27, 2015 at 07:24 PM
InvokeRepeat calls the function by a string name. That wont work UNet actions like Command and ClientRpc.
You can call command from inside a coroutine.