Variable of type World doesn't show up in creation!

Hello guys.
So the question is simple, from the shown picture we see i don’t have a choice to create a variable of type “World”.
But i can make such a variable from “Promote to Variable” choice selection.

how to create “World” variable in a structure.

Couldn’t google solution, would appreciate help!
Is that some kind of settings i need to set to show advanced variables or what?

image?alt text

1 Like

Why do you need a world variable?

To store level type in a variable.
Edit: So when creating level i just connect pins. Only way i know how to do it at this moment is by level name, which isn’t flexible…

1 Like

Worlds are generated and torn down through the Game Flow. So from that, I would be super careful with holding pointers/references to any UWorld that you didn’t request from GetWorld.

Thank you on the word of caution, lifetime of levels, and their validity is handled well.
What isn’t handled well is what level to load. Which i conveniently found a nice type for “World Soft Object Reference”.

What i don’t know how to do is:
Expose that variable type in blueprint and how to cast to it, since type “World” doesn’t show as choice in Blueprint editor.

Storing worlds by names is clunky… estimated to have over 100 levels, but their names are up for debate, but once i refer to specific level by name in code, and having the designer go over all levels and changing their name from ResearchFacilityEnteranceW to add level_ before the level name is a chore for me to go and update all the names of levels that are used, which i estimated is a loophole to cause BUGS.
But if i refer to levels by “World Soft Object Reference”. Their name is irrelevant, and can be changed anytime.

2 Likes

I am setting my the World(soft) references in editor with drop down menu which is VERY convenient way.

You can see that from the picture. It’s a drop down menu that allow selecting ONLY the thing… The thing that is referred to as World, Level, Map

From the second image you can see:
Created primary basic asset “Level”, hovering over it shows it’s Primary Asset Type: Map, which is stored as a World reference… i’m confused what it is :smiley:

But i want to store WHICH Level, not reference or pointer to the level.

How are you setting your World (Soft) refs? You must set from somewhere to match the Level name.

We have a similar issue, in that naming and use of FName’s to load a Map is somewhat inconvenient… but making a bit of a leap and judging by one of your names (ResearchFacilityEntraceW):

Are you doing level transitions based on moving through some area?
Have you considered using Streaming levels? Thus, the Level reference is handled in the Editor, so a change of Level name is auto-updated. Plus, it wouldn’t require a complete Level teardown and rebuild.

1 Like

Gotcha, fully up to speed on what you’re trying to do :slight_smile:

First, I would think that limiting access to UWorld (as a property) is by design, because of the inherent risks associated. Second, from what I understand and have read, a Level/Map isn’t strictly speaking a World (yet), but just a collection of resources.

There is an older question here, with a conversation between someone asking something similar to yourself, and Epic staffer Matthew J.

Now I fully (well, mostly… almost :wink: ) get what you’re after, I’ve hit the limit of what I know… hopefully someone can fill in the blanks!?

You can create an “Open Level (by object reference)” node in blueprint,

drag out the “Level” pin and promote it to a blueprint variable with the type “World” (with soft object reference)

6 Likes

OMG! Thank you!

This is how I’ve been getting Map references so far. I’m trying to put it into an Event “input” pin, but can’t find it in the type list.

I know people here are saying not to use the World reference, but from a programming POV it seems safer than saving a “string” of a Map name. If the map name changes you need to go find it everywhere. The only thing I can think of is creating a function in my game instance to keep track of all my map names and pull the map name from there; ie: Map Name always stays the same in code, but calling the function to pull it will grab it from a World soft object reference which can change automatically if the map is renamed.

I’m still learning a lot of “do’s & don’ts” in UE, but so far world soft references don’t seem to be causing any issues and programmatically they’re just placeholders in case the Map name changes.

Anyways - UE 5.1.1 still no World Soft Object Reference in the type list, but it can be stolen from an “Open Level by Object Reference” to variable as mentioned.

@ Epic Games: Can you guys please add a World Soft Object Reference to the type list. I don’t see the harm in it, especially if it’s just an ongoing list of maps. I guess it might be bad if one of the maps is deleted, but then again won’t you get the “Force Delete” screen like everything else and freak out?

Keep gaming! :slight_smile: Thanks for all the replies.

2 Likes

I feel this is a no sense :frowning: I want to create a database with levels, names, and some internal meta data… and i wish like to link to a map, not a name, becasue names changes but references not…
something like this:


i really dont understand :frowning:

My understanding is that no one in this entire thread answered the question? I’m at least the third person here asking how to set a variable to “World”.

I need to do this in a saveGame object, so doing the open level node and creating a variable from that is not an option. As Covrita said before me, using names, strings or text does not work.

It appears that there is no way to just set a variable type to World.

Seems like you can create a temporary Open Level (by Object Reference) node in blueprints, then right click the Level pin and select Promote to Variable.

1 Like

Yes, the issue with this is that you’re limited to variables. You can’t create functions/macros/events that take a soft reference to a world as an input parameter.

Heyya
You can drag the input of the Load Stream Level node to the macro/function input like this:

I’m a bit late to the party, but in case someone else stumbles upon this thread looking for the answer like I did, here’s what you’re looking for:
The variable type you want is Soft World Reference
From there, you can break it and get your soft object reference to Open Level

2 Likes