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"

Game instance lose object on "Open level"

Hello. I have inherited instance class, at game start i am creating an actor and write its reference in instance. Next i call "open level" and after that, i am lose actors reference, it becomes "not valid" and actor disappears from "world outliner".

PS Yes i am set new instance in Map&Modes.

As i read, actors would always destroyed when "Non-seamless travel". So i am little confused, because i need an incapsulated data with own methods, actors\object is pretty good for this, but i cant transfer it thru level change. And i cant use seamless travel, cause session creation.

Product Version: UE 4.21
Tags:
more ▼

asked Jan 09 '19 at 07:17 AM in Blueprint Scripting

avatar image

RoosterFather
13 3 4 5

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Ok, the solution is pretty simple, you just need UObject instead of AActor. UObject doesnt belong to level and may be transfered after the level change.

I am just create BP Class inherited from UObject, take ownership to instance and save reference. After "Open level", object still "Valid"

more ▼

answered Jan 09 '19 at 05:44 PM

avatar image

RoosterFather
13 3 4 5

avatar image Evigmae Jan 09 '19 at 06:15 PM

will have to try that one. the documentation never mentions it i think. and it makes sense. could come in handy!

(comments are locked)
10|2000 characters needed characters left

Hello there, sorry for your misunderstanding.

Actors belong to the map. if the map is gone, they're gone too. The only single class that exists beyond maps is the game instance, everything else will cease to exists the moment their map is unloaded.

If you're using level streaming and you need your actor to cross maps, then place in the persisten level.

If you're from one persisten level to another, you can't carry over anything. You would have to fake it by storing anything relevant to that actors in the game instance and then recreating it in the new map.

Keep in mind games are all about smoke and mirrors. You're always faking stuff that from the outside just looks right.

What you keep with seamless travel are the connections to the clients. but not the actors.

more ▼

answered Jan 09 '19 at 03:02 PM

avatar image

Evigmae
1.6k 7 3 8

avatar image RoosterFather Jan 09 '19 at 05:17 PM

So there is no right way to make any global logic outside instance? Recreating is not a way, because it much easier to make all variables and methods in instance from start and forget about transfering at all, than have an individual actor and additional methods\vars for transfer.

PS in seamless travel description, there are note about travel actor list, actors in that list able to travel between maps. I think it is what i needs, but there no way to use seamless travel in editor (without building execution file every time).

(comments are locked)
10|2000 characters needed characters left
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