Cast<>(). please explain what should be in <> and what should be in ()

Please explain what should be in <> and what should be in (). Something I can’t understand what needs to be inserted there.

Cast is a template function. In <> you need to put a class name you want to cast to, and in () pointer to object you want to change class. For example:

AActor* Actor; // just an example of object of AActor* type
APawn* Pawn = Cast<APawn>(Actor); // save Actor object to APawn* variable as a APawn*. If it's impossible - Cast returns nullptr;

Generally, in C++ in <> you write a template parameters and in () function parameters. About templates you can read, for example, here.

2 Likes