# Global Session Variables Not Working

**URL:** <https://forums.unrealengine.com/t/global-session-variables-not-working/1314794>\
**Category:** Issues and Bug Reporting\
**Tags:** unreal-editor-for-fortnite, editor, fortnite\
**Created:** [September 27, 2023, 11:50pm UTC](https://forums.unrealengine.com/t/global-session-variables-not-working/1314794 "2023-09-27T23:50:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LoPing](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/loping/32/737300_2.png) [@LoPing](https://forums.unrealengine.com/u/LoPing)\
**Post date:** [September 27, 2023, 11:50pm UTC](https://forums.unrealengine.com/t/global-session-variables-not-working/1314794/1 "2023-09-27T23:50:52Z")

</div>

### 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:  
[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}”)  
[/code]  
…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.

 ![testSessionVariables](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/7/b77e20d1e8d163f434f180dc01f5ac9221093f09.jpeg)

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.

---

<div class="post-metadata">

**Author:** ![t.tutiya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/t.tutiya/32/924637_2.png) [@t.tutiya](https://forums.unrealengine.com/u/t.tutiya)\
**Post date:** [September 28, 2023, 6:01am UTC](https://forums.unrealengine.com/t/global-session-variables-not-working/1314794/2 "2023-09-28T06:01:02Z")

</div>

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

For more information.

> [@MAJOR weak\_map GetSession() broken in 26.10](https://forums.unrealengine.com/t/major-weak-map-getsession-broken-in-26-10/1292369/9):
>
> These Notes are still there in the Verse digest for version 26.20, hinting that nothing got touched in that area.

---

<div class="post-metadata">

**Author:** ![LoPing](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/loping/32/737300_2.png) [@LoPing](https://forums.unrealengine.com/u/LoPing)\
**Post date:** [September 28, 2023, 9:24am UTC](https://forums.unrealengine.com/t/global-session-variables-not-working/1314794/3 "2023-09-28T09:24:34Z")

</div>

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!
