Doe's blueprint has something like static variable ?

Coming from unity3D i know that methods like FindObject and such are very expensive.
So in unity3D i use a static class to hold values that are accessible from anywhere.
In blueprint, as far as i know, i need to search for a blueprint instance to access it.
And all these searching in runtime is kind of expensive. is there any good solution for it with blueprint ?

i don’t think you can do such thing in blueprint , in my case coming too from unity , i put a public variable in a static class like gamemode and all the instance of my BP class are accessing to it

Yeah, you can use gamemode or gamestate for that.

Just out of interest, why would you not put your values into variables inside playerController?

I don’t use GameMode and GameState much apart from the default classes in GameMode. It sounds like I might’ve overlooked some use for these classes…

Thank you.

For single player games the distinction is unimportant and you can stick stuff wherever feels best for you.

However, in multiplayer games it starts to matter. In local multiplayer (e.g., split screen), you will have multiple PlayerController instances (one per player), but only one GameState instance, making it closer to ‘static’ for 's purposes.

Another important distinction between GameState and GameMode: The game mode is only instanced on the server, not the client, whereas the GameState exists on both and is replicated. The GameMode defines the ‘rules’ (such as which pawns and other classes to use), while the GameState surprisingly enough tracks state.

Cheers,
Michael Noland

2 Likes

I was thinking today of using gameMode for references to all the blueprints i want to use as static. and after reading the replys it seems like this is the way to go. Thank you all very much for your help! :slight_smile: