Be the first to post for 'InvokeRepeating() vs StartCoroutine()'!

If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.

I want to say “Stop hitting yourself” to my enemies.

2 Likes

I already felt overwhelmed with all these assets that I dragged into my scene. I baked the lights, so I guess I got more FPS this way. I wish I knew how to optimize all of this :smiley:

4 Likes

It’s coming later in the course

Demo of the updated attacking scripts. Coming along nicely :grinning:

1 Like

So it seems my projectile isn’t firing at the set rate, I’ve debugged the code and the secondsBetweenShots is being recognised directly before InvokeRepeating is called but regardless of the time I set the projectiles are firing like crazy as can be seen in my clip above. I’ve compared the code with the github version and it appears to tbe the same. Any idea what I may have missed/done wrong?

Code:
InvokeRepeating("SpawnProjectile", 0.0f, secondsBetweenShots);

Cheers
Pete

1 Like

Have the changes that you’ve made been applied to the prefab or an instance @KeplerPB, e.g. is the miss firing enemy not aware of your changes.

Hi Rob. I’m just changing the secondsBetweenShots on each instance - just going through the Archetypes lecture so trying different rates of fire etc.

1 Like

It feels to me like it’s because the invokerepeating() is constantly being called with it being in the update() method, but it seems to work in the lecture so not sure why not with mine?

1 Like

Solved it!

It was because I had left the distance check to call the CancelInvoke() as an else from the previous if statement.
So it was cancelling the invoke every other frame and invoking it again the frame after.

Phew! Good debugging experience if nothing else! :grin:

1 Like

hehe, nothing like talking to yourself for a few minutes to help resolve a problem…! :smiley:

Actually, I was here with you, I was just looking through the GitHub repository at what was at that stage and was about to as you if you had put the other if statement in… hehe… :slight_smile:

1 Like

Thanks Rob, appreciate you looking, I’d been talking to myself for over an hour!! :joy:As soon as I wrote the second comment I thought why would it keep being called? Ah maybe its being cancelled then re-called… doh!

1 Like

No problem Pete :slight_smile:

1 Like

Made a FireBall and a Simple Cast Animation in Maya

9 Likes

freaking wow! love the camera and where you are with this!!! Any tips would be great ( im embarrassed to show mine now)

This is very very good man!

What are you guys using to capture your screen vids?

Personally i used OBS studio (get the studio version its more stable) and its what ben and the team use to live stream.
There are alternatives like bandicam.

The camera is linked in one of the posts somewhere its from a free asset and i adapted it for use slightly.
The best tip i can give is to be mindful of how you will see your terrain. In the course they can get away with a bit more as certain angles wont be seen or got close enough to. This means more higher poly stuff or being a bit clever with barriers and distances :slight_smile:

Dont be embarrassed to post. Other than the camera and that i have done zombie runner and terrain making a few times it mostly stock code with free assets :slight_smile:

The knight has become the more standard asset for the course it appears :smiley:

1 Like

Thanks a ton man … im going to grab that camera, I dont like my fixed angle one. I will eventually add better graphics, I just haven’t had the time. But yours is looking great!

I ended up having to use Bandicam - thanks for that additional suggestion. OBS kept coming up black, doesnt like my GPU apparently.

2 Likes

I’m having some problems with the projectiles at the moment. I need to spend some time with this and see why this strange behavior is happening.

1 Like

Privacy & Terms