Announcement

Collapse
No announcement yet.

How do I get the name of a streamed level?

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

    How do I get the name of a streamed level?

    I have "Enabled World Composition" and my tiled levels stream in and out nicely. One of my assets is a railway track. In the construction script the asset reads coordinates from a file and creates a bspline with those coordinates. The construction script then places sleepers and rails to create accurately curved track. This screenshot show a 100m tile. The tracks (there are four of them) look straight because the radius of curvature is several kilometres - this is fine. Notice that the name of the level is 5042-2473. The next tile (upwards) is 5042-2474, then 5042-2475 etc. so the level name indicates the coordinates of the bottom left corner of the tile on a 100m grid.

    Click image for larger version

Name:	ue4-001.png
Views:	1
Size:	211.0 KB
ID:	1207611

    The tricky part is that the coordinate information is held in a file with a similar name but with a .json extension. So the data file for this tile is 5042-2473.json. I use "Get Current Level Name" (see below) to get the name and this is fine when I test the level on it's own.

    Click image for larger version

Name:	ue4-002.png
Views:	1
Size:	101.0 KB
ID:	1207612

    However, when I move to the persistent level to test the level streaming this node returns "Level_Base" which is the name of my persistent level and the rest of the blueprint attempts (and obviously fails!) to load data from the non-existent "Level_Base.json".

    I realise I could hard-code the name of the data file but there are potentially thousands of tiles so I'd really like to avoid this.

    So my questions are:
    1. Is there a way to get a streamed level name in a blueprint?
    2. Could I achieve the same result in a different way?


    Help and/or suggestions gratefully received!

    Cheers,
    Derek Hunter.

    #2
    Did you ever figure this out? I can't seem to get the name or reference of the sub streaming volumes the player is currently in without using c++ which is a real bummer for a full BP project. Let me know, thanks

    Comment


      #3
      Hi, you said you found a way in C++? Can you please post it?
      Join us in the development of PlaneShift, our free fantasy MMO.
      Check my YouTube Unreal Engine development sessions. Join our Discord.

      Comment


        #4
        A complete solution can be found here:
        http://www.ostinelli.net/ue4-get-actor-streaming-sub-level-name/

        It requires C++, but it exposes a BP node.
        Last edited by ostinelli; 12-23-2020, 07:44 AM.

        Comment

        Working...
        X