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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Get actor reference from persistent level

Is there a way to have a direct access to an Actor in the Persistent level from one of his sub level? By direct reference I mean selecting the asset in the viewport, right clicking in the blueprint and having the options to "Add reference to 'MyActor' "

Right now I have

  • MapMain (Persistent Level)
    • Map1

    • Map2

And I want the level blueprint of Map1 to be able to have a direct access to one of the actor that is in MapMain.

I have MapMain hold all the actors that would be persistent and Map1 and Map2 would hold static assets that would need to be streamed when needed. Map1 and Map2 also holds their respective triggers for various interactions.

I could do a GetAllActorFromClass but it would be nice to be able to have access to the objects from the persistent level

Product Version: Not Selected
Tags:
more ▼

asked Feb 12 '15 at 02:57 PM in Blueprint Scripting

avatar image

MarcAndreG
710 27 12 40

avatar image dbc211 Feb 25 '15 at 06:48 AM

Hi, did you ever find a solution for this? I would also like to reference actors directly between multiple streaming levels, but it doesn't seem technically possible as levels are self-contained. The only thing that crosses levels is the GameInstance and using state variables on that for all of my inter-level interactions doesn't seem feasible.

avatar image cancel Feb 25 '15 at 10:32 AM

The way I approach this problem in my own projects is to create my own custom AGameState subclass, and have a UPROPERTY field on it something like, AMyActor* PrimaryPlayerActor, and then in the BeginPlay() implementation on the AMyActor subclass, I have it get the GameState and set itself as the PrimaryPlayerActor property. Then the various level Blueprints (or whatever) can get the PrimaryPlayerActor from the GameState whenever they need to reference it.

avatar image dbc211 Feb 25 '15 at 06:45 PM

Thanks for the suggestion. It seems like that solution works if you need only a few "global" actors. I will have many++ interactions across levels, like a switch in level 1 opening a door in level 2. Ideally, I would like for a level designer to be able to reference actors between levels right in the editor (i.e. set the target door for a switch in the actor properties pane). But I know that's a pipe dream :)

avatar image pfrenette Mar 13 '15 at 11:24 AM

Anything new on this topic? I'm also interested in knowing if there is a clean way to achieve this. Thanks

avatar image JTensai Jun 23 '15 at 08:09 PM

I'm still trying to find a way to accomplish this as well. If a solution has been found for how to reference actors in the persistent level from blueprints I would love to hear about it! :D

avatar image ThisGuy5234 Jun 24 '15 at 03:32 PM

Yes, this is the problem we also currently have.

avatar image Thkaal Aug 05 '15 at 11:13 AM

For me is to see at least one actor across all levels (it is a very large actor), and have a LookAt on the player always looking at the actor across levels.

avatar image jtsmith Aug 05 '15 at 12:42 PM

From what I understand this isn't totally possible, though I'm sure there are some workarounds but unfortunately you can't get references to the level blueprints. The only options I've found is rather than have "persistent" objects have the level (or another blueprint) spawn it into the world on creation and store those references somewhere like GameState or GameInstance. Surely not ideal but is what we have to work with. Wish I understood the reasoning for not being able to reference level BPs

avatar image jtsmith Aug 06 '15 at 12:45 AM

I was just reading the pre-release notes for version 4.9 and one of the added features is this:

Level Blueprints can now be communicated with via interfaces using the Get Streaming Level node

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

1 answer: sort voted first

I would suggest that instead of trying to reference an object directly in another streamed level, which is an inherently brittle thing to do, consider using an event dispatcher or a blueprint interface to implement a function that does what you want it to do.

So instead of trying to manipulate the objects directly in the streamed level, you throw an event or call a function, and then the level blueprint that contains the objects does what you need it to do with them. In the long run, this is going to be safer and less-prone to breakage than trying to reference objects across levels.

more ▼

answered Jun 13 '18 at 03:37 PM

avatar image

KevODoom
176 5 8 19

(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