UE5 Bind Events

Hello, I have a question regarding Unreal Engine for optimizing my game. I’ve implemented a synergy mechanic where my weapons have an array of technologies. This array is traversed at different moments, for example when creating projectiles or when they are destroyed, in order to generate different effects based on the equipped technology. I’ve noticed that instead of traversing the array, I can use a dispatcher, make a call at the moment of shooting or when the projectile dies, and bind the tech to execute the effect. So, which approach is more optimal? Is it worth making the change? An important thing to note is that the technology arrays will have at most 3-5 elements.

Now Im using some like this:

Each projectil that is activate calls all tech event that previously was attach to de weapon.

But is this other option better? I Have to change a lot of thing in my project, I want to now if the performance will be increase enought or not.

I check FPS and didnt see significaly change. I just want an opinion about this.

There likely wont be any perceivable performance difference given the small number of elements. IMO the decision between array traversal or dispatchers is primarily based on the desired modularity. Generally if other classes are only meant to observe then a dispatcher is the way to go.

1 Like

Thanks, was very helpfull