Where is GetOuterAShooterPlayerController?

Hi,

I am very new to UE4 and I am trying to break down the ShooterGame example. I was looking at the definition of the SpawnBot console command in UShooterCheatManager.cpp. I see several references to GetOuterAShooterPlayerController, but I cannot find it’s definition anywhere. Is this being created by a macro? I keep hitting dead ends when trying to learn more about the engine internals. What’s the best way to learn a code project this large?

Thanks in advance!

This is somewhat late… but hopefully might be useful for someone else stumbling across this.

I have wondered this ever since I first looked through ShooterGame. UCheatManager has a similar GetOuterAPlayerController function that doesnt appear to be defined anywhere as well.

Finally just worked it out, not totally confirmed and can’t see where the code for that function is generated exaclty. But pretty sure it comes from the UCLASS(Within= specificer. There’s a few other examples in engine using within and they all have similarly named functions to get the outer uobject.

It’s not late… thank you, it’s useful for me

1 Like

ObjectMacros.h has the following macro definition:

// Declare that objects of class being defined reside within objects of the specified class.
#define DECLARE_WITHIN_INTERNAL( TWithinClass, bCanUseOnCDO ) \
	/** The required type of this object's outer ({{ typedef-type }}) */ \
	typedef class TWithinClass WithinClass;  \
	TWithinClass* GetOuter##TWithinClass() const { return (ensure(bCanUseOnCDO || !HasAnyFlags(RF_ClassDefaultObject)) ? (TWithinClass*)GetOuter() : nullptr); }

I assume that’s where the specific GetOuterX() function is defined for the object specified via Within=X in the UCLASS