No announcement yet.

Change a viariable value in game

  • Filter
  • Time
  • Show
Clear All
new posts

    Change a viariable value in game


    I made a Player Controller with a variable called : PlayerPawnStyle (structure)
    And I made a Player Pawn with a variable called : PlayerPawnStyle (structure)

    When I directly change in the editor, the value on the Player Controller variable and cast it on blueprint to the Player Pawn variable all is working !

    But when I try to change the value with a widget, the variable keep the default value... -_-

    So, Is it possible or is a way to change the value of a variable (structure) with a widget and in game ?

    Thanks a lot !


    Can you show the widget blueprint? I think its possible to accomplish what you are doing. Should be something like get player controller-->get pawn-->get/set variable name. I have my widgets cast to my game mode and my game state A LOT, but I can't think of any instance where my widget casts directly to an actor/pawn...


      Can you give us a little bit of information about what you are trying to achieve? I don't understand why you need the structure on both controller and pawn.


        I made a game where you create your character :

        So, I need to tell to my player controller the "options" (in structure) the player choose and keep this data.

        Then, when you are in game, I need to take this "options" from the player controller to the player pawn. I nee this cause the player controller can spawn a mech and controle it (so it's another pawn...) :

        I hope it can help you...

        While this time I found a tutorial serie that can help me and make the real great Multiplayer options for my game :

        Hope to share this game with you soon


          Oh I see. So you can have multiple pawns. What if you try as soon as you spawn the pawn, on begin play, copy the data from the controller to the local pawn? I hope that makes sense :P


            Yes, I already try this, read the information from player controller and give it directly to pawn... I was thinking all will be all right but... Not really -_-

            I think, networking is important at the stage... So I think I continue my tutorial serie and tell you if it help me to fix this problem :S


              Ok guys, I was totally out of how a multiplayer game give informations between blueprints xD

              You have to set PlayerState et GameInstance but you have to make lot of events running on client AND running on server !

              So, I understand that you can't work on blueprint communication as great as it should be without setting the Multiplayer Networking before.

              I will upload the youtube video soon to explain that !