Welcome back.
Now, if you play tested a little bit, you might have noticed a funny issue with the sounds that we're
playing.
For one, if we take this spell, press, equip and equip it to the left mouse button, we get that
sound.
It's not too loud, but if we close the menu and open it again and do this again, it's louder.
And if we do it again, it's louder and it's louder still.
So why is that happening?
Well, if we go into our spell globe button and look at our event graph, we've assigned a event to
the spell globe reassign delegate, and every time the widget controller is set.
We bind to this delegate again.
Now, the fix for this is simple.
When the spell glow button is destroyed.
In other words, an event destruct.
We unbind the delegate so we can take the spell menu Widget controller.
We can type spell globe reassigned and we can unbind.
We can unbind all events and all events is referring to all events on this object from the delegate.
And we can do this for all the delegates that we've bound on the widget controller.
We have ability info delegate.
We can unbind those.
So there we go.
Now let's see what happens before we actually do this, I'm going to disconnect that pin and just print
a string.
When spell globe reassigned is broadcast.
I'll change it to yellow.
So there's twice as many each time.
See that?
Now, what happens if we unbind?
Let's check it out.
It's the same amount each time.
So what we can do is go through and unbind all the events that we've bound to our widget controller.
We'll do that here and we'll do it in our other classes and I'll just go ahead and time lapse the process.
Now in the spell globe here we access none.
So I'm going to use a validated get just to be safe.
And you don't have to worry about removing from onclicked events or anything like that, just the ones
in our spell menu widget controller and that takes care of that and everything is working great.
Excellent job and I'll see you in the next section.