Level and Persistent Variables

Hi, sorry for my bad english. Im italian…but i try to explain my problem.

Im pretty new with unreal engine, anyway im following the manuals and learning a lot meanwhile. I have this problem, in a spaca game i made the ship, where the player move and interact. Then i made another game where ships fight each other. I made an interface for control the ship (the player sit and take control of ship). Now i want to take all the stuff in a new project, and here’s the problem.

  • I want to make a level for ship fighting and one (And more) for ship interiors, but i want them disjointed (i know i can tie levels with world composition) so how i can tell the engine “i want to load two levels?”
  • I tried to launch a stream level from one of them, it can work?
  • As long i cant refer on a blueprint to an item from another level i made a gameistance who store the vector of the controls input, but even if the variable is public and the gameistance is loaded the blueprint dont send info from the local level to the global one (so i cant even retrieve it from the second level)

Thousand thanks for the answer, hope is enough clear

Ok so, first of all: I guess you are creating a multiplayer game. So the first thing to notice is, that a Server can only have ONE level open at a time. So you can’t tell a client to
open another level, without him being disconnected. What you CAN do, is using “LevelStreaming”. Sadly i have never used it, but there are tutorials about it.

You just unload the space part and load the interior if you walk into the ship or open its door.

If i’m not mistaken, you will always have one persistent level, that is always loaded. You could store variable in that, but the LevelBlueprint itself
is not that good to store stuff. Since you are not changing levels, but just loading them, you should be able to access the GameState/PlayerState etc
like normal. So saving a variable there, it should not get destroyed.

The GameInstance would be a way to get Data from one level into another. The GameInstance is created at the Start of the Game and destroyed when you close it.
So you could store a vector there and just call “GetGameInstance” everywhere you want.

If this doesn’t help you, then please try to specify your problem (:

Thanks for the answer.

The problem is that the space level is a “ship game” while the interior one is a “third person game”. So i can let the player move from a level to another. Im trying some solution but i found a new problem. Im not totally sure the Space level is loaded, the only “visual communication” is a stream camera 2d on the ship, with the texture/material on the “interior” level.- So my question is:

  • The ship dont move cause he dont get the variable from the player? (Player in interior->gameistance->Ship level). I tryed to monitorize the variable, in the interior level he change, but in the game istance no response.- (I put it public and gameistance is setted on the project)
  • The ship is moving but i dont see it cause the render camera is not refreshed?
  • The level is totally unloaded?

Obviously before try that i made all that stuff in a single level and it works.
Reading tutorials about streaming level (And load levels) i maded the persistent level (Space) who is the server level, and a child one (interior) who is loaded from command inside the Space level one blueprint (And put them in the same layer of a multilevel world). If i right understood the manuals the first persistent level is always loaded so i think both level are loaded.

Ok i make some screen tomorrow (Im new so they are confused like my mind, i make them clear and will see)

I can’t tell you how to use Streaming Levels. As i said, i did not work with them yet.

You may want to post some screenshots of your setup and the involved blueprints, so others can better see what might be wrong (:

Solved:

I have made a persistent level “spazio” with a child one streamed “spaceship”. Then i put them in different location (avoiding the overlay of levels).- Now when my character sit on the consolle i transfer the controller array (who is a variable in a game istance) to the space level. (There’s are other boolean variables for other stuff too to be avoid).- Then space level take back the camera to the ship, so the player see himself sitted on the control command, with a screen who show the space in front of the ship, and his controls move the ship.-

Thanks again for the help