My reaction to this video

I am a little bamboozled, but I’m sure it will make more sense later.

My current understanding is that our Position Report has a bunch of methods it can access which are part of the Unreal code for actors? And that by using GetOwner() we are calling a method and ->GetName() accesses more methods within that method via a pointer? I am not familiar with the concept of pointers which is why this is hazy for me.

Position Report is an ActorComponent, which is a little different from Actors. The details are listed at http://api.unrealengine.com/INT/API/Runtime/Engine/Components/UActorComponent/index.html

GetOwner is a member function of UActorComponent and returns a pointer to the owning actor. Many different classes have the GetOwner member function. Stringing together arrow operators like this is a handy shortcut.

FString ObjectName = GetOwner()->GetName();

GetName is a member function of the owning actor. Another way to write the code above is:

AActor* TheOwner = GetOwner();
FString ObjectName = TheOwner->GetName();

Thanks Rideout, just getting back into this again after learning C++, appreciate the reply

Privacy & Terms