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"

How do i get the name of the streaming level that actor is present in.

Hello, I would like to make a save/load level loading system and I need to get the level name that the actor is in at that moment. I've tried using "Get Current Level Name" function, but it returns the main persistent level name, not the sub-level that the actor is at that moment. Thanks in advance.

Product Version: UE 4.15
Tags:
more ▼

asked Feb 19 '17 at 09:05 AM in Blueprint Scripting

avatar image

Toody_HD
8 1 3 3

avatar image chrarlait May 21 '17 at 08:13 PM

Have you found a solution yet?

avatar image Toody_HD May 21 '17 at 08:18 PM

What I've done is to make a save function for each level that i have and put them in each level.

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

1 answer: sort voted first

Here you go:

   Actor->GetLevel()->GetOuter()->GetName();

For some reason all the ULevel-s are called PersistentLevel. Sounds like a bug to me, but who knows. Their outers have the name we are looking for tho.

I spent more time on the internet trying to find an answer to this question than I did in visual studio to find the solution of my own.

alt text

l3.png (31.8 kB)
more ▼

answered May 28 '17 at 10:56 AM

avatar image

Elathan
426 25 27 59

avatar image ryanbai Jun 26 '18 at 02:18 AM

Thank you!Perfect!

avatar image Teapot Creation Oct 16 '18 at 02:12 PM

Hey ! Was just wondering : any idea how to achieve this in Blueprints ?

avatar image Elathan Oct 16 '18 at 02:25 PM

Afaik you can't. Writing a static c++ function and calling that from BP is the way to go.

avatar image MadRat1171 Nov 08 '18 at 09:51 PM

That's what I'm looking for. Too bad that I'm a total c++ noob. Can someone write full function in c++? I'm struggling an hour to get this working and I have no idea what am I doing. Anyone can help?

avatar image Elathan Nov 09 '18 at 08:32 AM
 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "CoreMinimal.h"
 #include "Kismet/BlueprintFunctionLibrary.h"
 #include "GameFramework/Actor.h"
 #include "MyBlueprintFunctionLibrary.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class PROJECTNAME_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
 {
     GENERATED_BODY()
     
     UFUNCTION(BlueprintPure, Category = NYTaskHelper)
     static FName GetStreamingLevelNameFromActor(AActor* Actor)
     {
         if (Actor != nullptr)
         {
             return Actor->GetLevel()->GetOuter()->GetFName();
         }
 
         return NAME_None;
     }
 };
avatar image MadRat1171 Nov 09 '18 at 08:51 PM

Thank you for that ! Works as it should.

(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