The elusive "getgameinstance()" method

Struggling to get this object.

I have followed the following here:

and Visual studio tells me here:

UMyGameInstance* GI = Cast(GetGameInstance());

identifier “GetGameInstance” is undefined

Class is defined as…
class UMyGameInstance : public UGameInstance

So how can I get this object?
I keep reading about three different includes for this and so on.
I have tried every method I can find but always end up with the same exact failure.

Nevermind.
#include “Engine/World.h”
and
GetWorld()->GetGameInstance()

is my friend. Sorry for the noise.

2 Likes