Announcement

Collapse
No announcement yet.

Communication between 2 level blueprint

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

    Communication between 2 level blueprint

    Hi,

    I have a map that is set with multiple levels.
    I wanted to be able to access to a public variable of one of my level blueprint in another one.

    How should I do this?

    Thanks,

    #2
    Hi!

    For transfer data between levels you can use

    SAVE Game
    https://docs.unrealengine.com/latest...nts/index.html

    or GameInstance

    https://www.youtube.com/watch?v=K_4CWDxwufg

    Comment


      #3
      I think yI need to clarify my needs.

      I'm not looking to transfer data between levels (a new map that I'm loading) but "sub levels" (https://docs.unrealengine.com/latest...ser/index.html)

      So I have multiple level loaded at once (like in the ShooterGame project), and I wanted to communicate between the LevelBlueprint of those level.

      Thanks,

      Comment


        #4
        Originally posted by Elvince View Post
        I think yI need to clarify my needs.

        I'm not looking to transfer data between levels (a new map that I'm loading) but "sub levels" (https://docs.unrealengine.com/latest...ser/index.html)

        So I have multiple level loaded at once (like in the ShooterGame project), and I wanted to communicate between the LevelBlueprint of those level.

        Thanks,
        Using GameInstance as a go-between is still your best bet. Last I checked, referencing a variable from the level blueprint in another blueprint is a no go. However, if you send that variable to your GameInstance, and then have your second level BP read it from there, that should work.
        Twitter: @zerofiftyone_
        Website: zerofiftyone.net - My game development blog
        Button Frenzy store page: http://store.steampowered.com/app/454630

        Comment


          #5
          Thanks,

          That's sad this is the only way in BP. I was thinking about loop in all levels, try to cast them properly to my "Level Type" and then access the public variable/events etc... but I didn't managed to get it.

          I will try again or go by the GameInstance path... but it's a kind of bit hacky.

          Comment


            #6
            There's a logical reason why you can't reference level BP variables from other blueprints. It creates a dependency on that level blueprint existing (and being loaded) at all times whenever the referencing blueprint is present.

            So for example, let's say you have a BP for a clock prop, and you want it to reference the in game time (which you have stored as a variable elsewhere); if you stored that variable in the level BP, that would mean the clock BP wouldn't work unless it was used in that level, since it would have nothing to reference otherwise. However, if the variable was stored in GameInstance, you wouldn't encounter this problem, as GameInstance is present all throughout runtime, and persists through level changes.

            I've used a pretty general example, and I realise your situation is a little bit different as you want to communicate level BP to level BP, but the reason that it's not possible is the same. I hope this helps.
            Twitter: @zerofiftyone_
            Website: zerofiftyone.net - My game development blog
            Button Frenzy store page: http://store.steampowered.com/app/454630

            Comment


              #7
              I feel like declare a static variable in your class of game mode in c++, then we make it

              Comment

              Working...
              X