Download

How Unreal engine cast type without using dynamic_cast?

How Unreal engine cast type without using dynamic_cast??
I wanna know how unreal engine manage class type hierarchy.
How it check if a type is derived from other type without using dynamic_cast.

It uses custom reflection information (UClass, FProperty, etc.). When you compile your code, UHT parses all the headers and writes a lot of unreadable code that sets up these data structures behind the scenes that gets included in your binary. At runtime, every UObject has a pointer to its UClass, from there you can check if a cast should succeed or not.

You have all the engine source code available, so you can just go find out what Cast does behind the scenes if you’re curious.

1 Like