Game Mode & Game Instance Reference

When I set a reference variable for each of the 2, Game Mode and Game Instance, Must i also cast to the specific game mode/instance? OR can i simply just plug my “get game mode” & “get game instance” and promote the out pin to a variable?

Pretty sure you need to cast. Assuming there are functions/events/variables that you made in your game mode or instance, casting and setting that as a variable lets you access those.

I’ll usually cast to game mode or game instance on begin play and store that as reference to be used later in code.

What happens if I use a different game mode in different levels? Do cast to character FROM the game mode instead and set that reference from gamemode into the character?

Suppose you could do it the other way around since the Character is a consistent class.

I don’t work with game modes too much, so this is just a generic thought, but if you put all the important stuff in a parent game mode (functions, vars, etc.) and then have children game modes that simply run the code - couldn’t you cast to the parent class and be able to use all the parent stuff in the childs? Does that even make sense?

When you get the initial reference to any class you need to cast, then save “AS blah blah” to variable. From that point forward you won’t need to cast when using “That Variable Reference”.

Only exception to having to cast is when you directly spawn something. e.g. character spawns something … that something doesn’t need to cast to when saved to a variable.

When the game mode changes, then yes you have to cast. return of cast can be saved with no further casting needed. Unless the mode changes again.

Thanks! I am still learning how to manage everything