Announcement

Collapse
No announcement yet.

Global Variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Global Variables

    I'm a bit confused about how to set up a global variable.
    I need a "Level Colour" that can be changed in game by many different blueprints.
    There are then many parts of the level that will have to change to that colour whenever the variable changes.
    Any help is appreciated.

    #2
    Global variables aren't really a concept used in blueprint. BP is based around references and interfacing.

    The best thing you could do is add a GameInstance blueprint and add it to your project. Put variables you want to be global in the GI BP and you'll be able to access them from anywhere at any time. Just "Get Game Instance" and cast it to the type of GI you created and access all of your variables from it. The GameInstance is created and destroyed only once, so it will persist for the life of your game.
    Procedural, modular, on-the-fly animation - iTween For UE4
    - Actors - Components - UMG - Ease In - Ease Out - Path-constrained Animation - $0

    Runtime Datatable
    -All the fun of DataTables dynamically loaded from text or Google Sheets while your game is running!

    Comment


      #3
      How exactly does that casting work?
      Say I have a variable in the game instance called "LevelColourGlobal" and want all the boxes in the level to be the same colour, how would I set that up?
      Which Blueprint would have the casting node?

      Comment


        #4
        Hello,
        The britain did a short video about that : https://forums.unrealengine.com/show...Gong-Tutorials (don't forget to thanks him if this usefull to you ^^)

        More infos there https://docs.unrealengine.com/latest...nts/index.html where is shown how save your game.

        Comment


          #5
          Thanks very much. The video helped a lot

          Comment

          Working...
          X