Dynamic Casting Best Practice

Thanks for all the replies, very helpful :slight_smile: I’m just getting used to the unreal way of doing things :smiley: I was just making sure because dynamic casting is quite slow for an operation that doesn’t involve fetching memory so often avoided in performance sensitive code and too much dynamic casting can be a code smell. It sounds like here the benefits gained from garbage collection, serialization and common interface greatly outweigh this (minor) inconvenience.

Not at all, I’m just checking that I am not getting into bad habits early on :slight_smile: As I said dynamic casting is often avoided where possible in the wider C++ community so I need to learn how to use Unreal and unlearn some of the things I “know”. Since I’m new to the engine I sometimes get things to work but not sure if I am doing it the “proper” Unreal way or if I have just performed an ugly hack.

Thanks again!

1 Like