# Game instance subsystem not initialized during GameInstance Event Init

**URL:** <https://forums.unrealengine.com/t/game-instance-subsystem-not-initialized-during-gameinstance-event-init/1257768>\
**Category:** Programming & Scripting\
**Tags:** subsystem, game-instance, unreal-engine, CPP, Blueprint, question\
**Created:** [August 11, 2023, 12:18pm UTC](https://forums.unrealengine.com/t/game-instance-subsystem-not-initialized-during-gameinstance-event-init/1257768 "2023-08-11T12:18:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BioMedKUL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BioMedKUL](https://forums.unrealengine.com/u/BioMedKUL)\
**Post date:** [August 11, 2023, 12:18pm UTC](https://forums.unrealengine.com/t/game-instance-subsystem-not-initialized-during-gameinstance-event-init/1257768/1 "2023-08-11T12:18:32Z")

</div>

Hey,

I’ve been trying to write a plugin that handles communication with a server. It does so using a GameInstance subsystem. I got everything working, but then I started wondering if I could make the most used function static, so I don’t always have to include the Subsystem node when calling it in blueprints.

To get access to my subsystem’s variables when calling the static function, I call GetSubsystem() and this works. except it throws an error when calling it in the Event Init of the Game Instance. The GetSubsystem call returns null here causing the code to fail.

According to documentation, Game Instance subsystems are initialized as the Game Instance itself is initialized but I would expect this to be done before calling the blueprint’s Event Init.

```auto
// ...
UWorld* world = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::Assert);
	UGameInstance* instance = world->GetGameInstance();

	UIASSubsystem* IASSubsystem = instance->GetSubsystem<UIASSubsystem>(); // Returns null
// ...

```

My question is whether it’s normal practice to try and get my variables in this way (I originally tried using static variables but I was getting Unresolved External Symbol errors when I did that) or how else I should go about using the subsystem’s variables in the static method. And if there is a way to force the initialization of the subsystem before the Game Instance’s Event Init runs.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![kru](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kru](https://forums.unrealengine.com/u/kru)\
**Post date:** [October 19, 2023, 3:42am UTC](https://forums.unrealengine.com/t/game-instance-subsystem-not-initialized-during-gameinstance-event-init/1257768/2 "2023-10-19T03:42:20Z")

</div>

I was also bit by this, and also found it weird that the GameInstance Event Init blueprint event was fired before subsystems were initialized and available. The solution I went with was to inherit my own class from GameInstance, override the Init, call Super::Init and then raise my own custom PostSubsystemInit event to blueprints for designers.

```auto
UCLASS(Blueprintable, Abstract)
class AWESOME_API UAwesomeGameInstanceBase : public UGameInstance 
{
	GENERATED_BODY()

public:
	virtual void Init() override;

protected:
	/** Opportunity for blueprints to handle the game instance being initialized after the subsystems have been initiatlized. */
	UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "PostSubsystemInit"))
	void ReceiveInitPostSubsystem();
};

```

```auto
void UAwesomeGameInstanceBase::Init()
{
	Super::Init();
	ReceiveInitPostSubsystem();
}

```

In case anyone else also gets bit. It is a tad weird, considering that the [official MVVM documentation](https://docs.unrealengine.com/5.3/en-US/umg-viewmodel/) suggests that the game instance is a convenient place to initialize viewmodels. Yet, the MVVMGameSubsystem isn’t available until after the Game Instance’s init event has fired.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [November 18, 2023, 3:42am UTC](https://forums.unrealengine.com/t/game-instance-subsystem-not-initialized-during-gameinstance-event-init/1257768/3 "2023-11-18T03:42:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
