Welcome back.
Now in this video we're going to look at one issue I noticed while testing.
And this is just one of those things that pops up that you may have missed in development.
I'm going to show you the issue and we can repro it this way.
I have my.
Fireblast assigned to slot two.
I'm going to assign it to my right mouse button so I can see it here with my abilities.
Menu open.
Now, this is not an issue if we're disabling input while these menus are open, which is the default
state that I'd like to have.
But we have input possible for testing purposes.
And this issue only pops up with the menu open.
And I'm going to show you what happens.
I'm going to activate this ability Fireblast which has a long cooldown like five seconds or so.
And during that cooldown before the cooldown is over, I'm going to reassign Fireblast to a different
slot, such as the left mouse button, and that's going to make my right mouse button vacant.
It's going to be empty, and it's going to still be updating the cooldown timer.
That's because, well, we're never actually telling it not to.
So I'm going to show you the issue.
I'm going to cast the spell and equip to the left mouse button.
I was too late.
I'm gonna try again.
There we go.
So we have the cooldown and as soon as it's done now we're setting this to a blank texture.
And that's because we're setting the render opacity for the texture back to one, but it no longer has
a valid texture.
So really what we should be doing is first of all, not setting this back if we've reassigned the ability
somewhere else.
And we should also stop showing that countdown value, we can even stop the countdown altogether if
we've reassigned this ability to somewhere else.
So how do we know we've reassigned the ability?
Well, let's open our spell globe.
Not the spell globe button, just the regular spell globe.
This is the one that responds to cooldowns.
Now, if we're in the cool down here, we know that we have a cooldown timer handle we can clear and
invalidate in any time.
So how do we know when we've reassigned this ability somewhere else and this globe should be empty?
Well, we receive ability info, and when we receive ability info that matches with our input tag,
we're checking to see if it's equal to abilities none.
If it's ability is none, we clear the globe.
We can do lots of things here.
We can also clear and invalidate the timer so that we never reach the end of that timer.
Our timer is called.
Cool down timer handle so and receive ability info here.
We can take cool down timer handle.
And we can clear and invalidate the timer.
So clear and invalidate timer by handle.
And now we'll never reach the end of that cooldown timer.
Let's go ahead and see how this works.
So I'm going to assign the ability to the right mouse button.
And I'm going to cast the spell and then assign it to somewhere else.
Here we go.
Okay, so we've stopped the timer.
We also need to stop showing that countdown text, so let's take care of that as well.
So what we can do is we can get our countdown text and I can't remember what it's called.
Text cooldown is what it's called.
So we can get text cooldown.
And I think the way that we're clearing this is by setting its render opacity.
But I want to make sure I'm doing this consistently.
If we go to update.
Cooldown timer.
Text cooldown.
We set default state.
And yes, we're setting render opacity to zero.
So back in receive ability info I'm going to call set Render Opacity.
And set it to zero here.
Okay.
Let's try to repro the issue again.
Equipping to right mouse button.
Casting and re-equipping and it looks fine and that cooldown has stopped.
And if I assign something else here, then we now have something else here.
So that fixes that issue.
Now these are these little problems that can pop up, and they're kind of hard to catch while you're
developing.
And they just sort of pop up in testing.
And that's partially why testing is so important because issues like this pop up.
So it's possible during testing you may find other small issues here and there.
And it's really just a skill that you have to develop finding these edge cases and figuring out solutions
for them.
All right.
That's going to conclude this video.
And I'll see you in the next one.