Is casting expensive?

Fantastic to get some hard numbers on that! That is what I would expect - the decision to cast vs use an interface is not really about performance, but about architecture. I would only use an interface when you need one - when you have multiple ‘unrelated’ classes that should share some behavior or event. The example I always give is if you want a flame thrower that can ‘burn’ things, you probably want a ‘burnable’ interface that lots of different BPs can implement. If you only care about one thing (e.g. see if it is the player that i hit, and if so, give them a key), then casting is a bit simpler because you don’t have the hassle of making an interface.

2 Likes