Global Session Variables Not Working

Reference ID

17310037-4e35-f4f9-548c-afab539a69e9

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Summary

Session Variables don’t seem to be working. Even Epic’s exact code from the’ Global Variables/Session Variables’ documentation doesn’t work, even in a session originating in UEFN, much less from Fortnite.

Steps to Reproduce

Please see my Island code for 7620-1670-3921 or I can send the code, but Epic’s example code:

var GlobalInt:weak_map(session, int) = map{}

ExampleFunction():void=
    X := if (Y := GlobalInt[GetSession()]) then Y + 1 else 0
    if:
        set GlobalInt[GetSession()] = X
    Print("{X}")

…doesn’t even work. I wrote some code that would show at what point its failing and you can read and write within a match, but even if you stay within the session, a new match will have an empty weak_map(session, var_type) even if it was filled in the previous match.

Expected Result

Save to a global session variable and the value should be available to other matches in the same session.

Observed Result

Global session variables are lost between matches in the same session. Also getting a Fortnite error of “Downloaded new content because something went wrong” on matches relaunched with “[R] Ready Up”.

Platform(s)

windows

Island Code

7620-1670-3921

Additional Notes

Island 7620-1670-3921 is the smallest template Island with just one creative device that read/writes a session variable and a triggered end-game device so that the island can be exited as in a real match. It has HUD messages showing the success or failure of each step (reading from a previous match, writing in the same match, and reading from the same match), since Epic’s example just has a “Print” which doesn’t help when testing in a Fortnite environment.

Note the HUD shows four status messages with a delay of five seconds between each.

Also my understanding of sessions are:
(1) In Fortnite staying on the same island and replaying with ‘Ready Up’ keeps you in the same session (going to the lobby will exit the session).
(2) In a session launched from the UEFN editor, just hitting “Play” again should keep you in the session if you don’t push changes or go to the lobby.

Unfortunately, session corresponds to current round (from v26.10).

For more information.

1 Like

Thanks for the info, but the session variable was a big part of my current island. Epic’s response was confusing. Do you think they were going to fix it?

Again thanks, but that’s bad news!

1 Like