Announcement

Collapse
No announcement yet.

How Can I Create Global Variable.

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

    How Can I Create Global Variable.

    There are many levels in my project, data missed when level changed. I want to keep all data in several objects ,How can I create global object (global variable) .

    #2
    Use your Game Instance or Game State class, you can access these classes by using "Get Game Instance" node and casting to your Game Instance, or the "Get Game State" and casting to your Game State, and then "As GameInstance" or "As GameState", get the variable you've put there and do whatever with it.

    This method can be done from pretty much any class you'd want to be using to get your variable (including level BP, character, playercontroller, etc.)

    Comment


      #3
      You can also use BP-Function-Library Getter / Setters as a layer on top of ^^ THIS ^^

      Comment


        #4
        There's also "Game Singleton" class... but Epic want everyone to quit using it and switch to GameInstance instead.
        | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

        Comment

        Working...
        X