also having an array of actors where uaz, ural…
Is it possible to create a C ++ function for casting by string, let’s say having an array of strings, using forEach to iterate over all the available strings (like: uaz,ural…), turning to castTo uaz;castTo ural…?
the task is to make sure that the current forEach actor is UAZ, Ural, to refer to him after cast?
Hi there!
But whay dont use TArray or TArray>?
Anyway, you can try to find class with several things:
- https://dq8iqaixvew1d.cloudfront.net/en-US/API/Runtime/CoreUObject/UObject/FindObject/index.html. Example: Get Blueprint class by String in C++ - UE4 AnswerHub
- TObjectIterator | Unreal Engine Documentation. Just iterate through UClasses and check names. But this can be slow. Example: Possible to loop through all blueprint sub-classes? - C++ Programming - Unreal Engine Forums
This tags eat up all generic methods )) I mean why dont use this
TArray<UClass*>
or
TArray<TSubclassOf<>>