I just want to make sure if I understand it correctly.
So when I start the game a game instance is created.
If I join in a multiplayer game, each client will have its own game instance?
And the getGameInstance node will get the client’s game Instance when its called ?
Game instance created when game starts and lasts until that game executable closes, persisting across level changes and joining sessions etc.
Game instance is only aware of its own executable. Does not have any connection between server and clients.
When I need to persist something from one level to another for example when a client joins a server’s level then I put it in game instance to save it for after the level switch. Then after Game state starts on the newly joined or opened level I have it grab anything it needs to inform all clients about from the Game Instance and can tell the server via playercontroller RPC to set those vars or multicast a function to everyone about it.
The GameInstance is alive as long as the application is alive, pretty much as its name suggests, it’s an instance of the game. With that said, when a dedicated server is launched, a GameInstance will be created in response (on server). The GameInstance on server has no clue about the GameInstance that exists on clients, which gets instantiated the moment you launch the game, and is destroyed once you exit and close the game instance.
Quick recap: Every server instance has his own GameInstance, and every client instance has his own too.