x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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

Product Version: Not Selected
Tags:
more ▼

asked Jan 23 '15 at 02:45 PM in Blueprint Scripting

avatar image

Hokan22
8 3 4 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jan 24 '15 at 11:43 AM

avatar image

Asher S Einhorn
645 94 80 180

avatar image Hokan22 Jan 27 '15 at 03:06 PM

I don´t underestand what u mean by:

"Then you also create your other objects inside your game mode or level blueprint."

And by create do you mean I have to make a node and let this node at the start of the game?

Kind Regards

avatar image Asher S Einhorn Feb 05 '15 at 02:33 PM

so you create everything in one place. Class A contains your globals and you make one of it. All other classes have a variable of type 'Class A' in. You set this variable to be your one instance after you create them.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question