Hello,
I was wondering how to set child actor class of child actor component having the object path of the actor blueprint that i want to set.
What i have ➞ the object path of an actor blueprint
What i want to do ➞ to set above actor blueprint class to the set child actor class node of actor component.
Im sorry as i aint good enough with c++ yet. Any idea how to achieve it? Thanks!
Kehel18
(Kehel18)
February 8, 2021, 4:03pm
2
Hello! Why are you using FString to represent class?
I meant that input is a string of blueprint reference path and i want to get class of that blueprint so that i can set it to the input class of SetChildActorClass node.
Kehel18
(Kehel18)
February 9, 2021, 5:15pm
4
Ok, so you can take a look at this:
The input is BP actor object path and output is class of that bp. I used ‘cast to actor’ this class and then set actor class to set child actor class.
void UClassNameFromBPObjPath::GetClassFromBPObjPath(const FString& BPActorObjectPath, UClass*& BPActorClass){
FStringAssetReference itemRef = BPActorObjectPath;
StaticLoadObject(UObject::StaticClass(), nullptr, itemRef.ToString());
UObject itemObj = itemRef.ResolveObject();
BPActorClass = Cast(itemObj);
}