Saving default variables in another Blueprint
Hello unreal Community,
I have a question regarding default variables.
I have some default variables inside a blueprint widget, which I can't access unless I create the widget. Now I want to use these variables in another map, where this widget will never be loaded. Since its an array I don't want to create those variables and its values multiple time.
My question is:
Is there a way I can set these variables once in a specific and then access them from different parts of my project eg. widgets and actors?
Kind Regards Alex
asked Jan 23 '15 at 02:45 PM in Blueprint Scripting
I think what you're asking, is - is there a way to have global variables.
I've thought about this for both blueprints and normal coding and i think the best answer is this -
In your game mode or perhaps your level blueprint you create a new blueprint, called say, GlobalsBP. Inside that you create all the information you might want.
Then you also create your other objects inside your game mode or level blueprint. your other objects will have a variable of type GlobalsBP inside them. After their creation, you set their variable to be the instance of GlobalsBP that you made in the main class - the level BP / game mode.
This is how my AI work in my game - an AIManager is updated with their information when they are created and is also sent into each AI as a reference. The AI then listens to the manager class for commands. I also use the same method to store a global list of all world cover etc etc.
answered Jan 24 '15 at 11:43 AM
Asher S Einhorn
Follow this question
Once you sign in you will be able to subscribe for any updates here