Casting slate widgets

I think likw static_cast, StaticCastSharedPtr does not do anything to check the type so still needs if (widget->GetType() == "typename") before if you don’t know for sure it is safe to downcast.

Is there any utility function that casts it and checks the type, setting the TSharedPtr to null/Invalid on fail? I think GetType gives an FName, so it is maybe not possible without a macro, or C++ reflection whenever that gets added?

1 Like