I was testing some things in c++ and blueprint, and i saw the Get Component By Class node, and the return pin class changes based on the class that you select.
And i made a function in c++ with the same goal, but it just returns a SceneComponent, so i cannot use the StaticMesh functions.
This is the Get Static Mesh code that i made, and it is a static function:
UActorComponent* ABaseItem::GetStaticMesh(const AActor* ActorToSearch, const TSubclassOf<UActorComponent> ComponentClass)
{
UActorComponent* StaticMesh = ActorToSearch->GetComponentByClass(ComponentClass);
return StaticMesh;
}
I went to the Get Component By Class code, but i couldn’t find anything that seems to make the node works that way.