Casting into Controller failed

I am trying to perform this cast operation

auto temp = GetWorld()->GetFirstPlayerController();
auto Controller = Cast<ACustomPlayerController>(temp);

The Declaration for class ACustomPlayerController is as follows

class SHOOTINGGAME_API ACustomPlayerController : public APlayerController

However, the Controller variable returns a nullpointer. Can anyone explain to me why this cast is failing?

If a Cast fails its simply not the thing you are Casting to. Did you make sure to make your Custom Controller the default one in your Game Mode?