I’m trying to access a component of an actor from another actor. But my code doesn’t work.
Here is my code.
FSphere* FollowingPoint;
for (TActorIterator<AActor> itr(GetWorld()); itr; ++itr)
{
if (itr->GetName().Contains("PC"))
{
TArray<FSphere*> Components;
itr->GetComponents<FSphere>(Components);
FollowingPoint = Components[0];
}
}
Here is the error message.
C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\GameFramework/Actor.h(2698): error C2338: ‘T’ template parameter to GetComponents must be derived from UActorComponent