x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Load Map with Reference

Can someone explain me how to load a map via its path in the content?

I have made some search and found this but it fails:

 UGameplayStatics::OpenLevel(GetWorld(), "World'/Game/Map/ElvenRuins/ElvenRuins.ElvenRuins'", 0, "");

It gives me this error at runtime:

alt text

I do not get what is going on :S

Product Version: UE 4.10
Tags:
untitled.png (10.2 kB)
more ▼

asked Dec 18 '15 at 10:17 PM in C++ Programming

avatar image

ErayT
250 36 37 169

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I'm unfamiliar with the format you're using, but this worked for me:

 FName LevelName = "/Game/Maps/TestLevel";
 UGameplayStatics::OpenLevel(GWorld, LevelName, false);

Otherwise, if "ElvenRuins.ElvenRuins.umap" exists, I'm not sure what's going on. Are you sure the error comes from the line you listed?

more ▼

answered Dec 18 '15 at 10:42 PM

avatar image

rantrod
1.5k 49 47 216

avatar image ErayT Dec 19 '15 at 07:50 AM

I have changed my code as you suggested:

 UGameplayStatics::OpenLevel(GetWorld(), "/Game/Map/ElvenRuins/ElvenRuins", false);

But still getting the same error.The url in the code is true. I dont understand why it mentions another map url in my content :S

avatar image ErayT Dec 19 '15 at 08:31 AM

Ok wait it worked! I think it was a hot reload bug. The solution you gave me is correct. Please post your format as answer. I will mark as solution.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question