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. 

Reparent Spawned actor to different streaming level

Here's our situation: An actor spawned into the world can be spawned into the streamed level as its parent and then be removed from this streamed level as the player travels to a different part of the world. That means when that level is unstreamed the actor will be unstreamed with it. Where this gets complicated is that say you craft a weapon at the furnace in the main map - this is being spawned in the main map. If you bring it over to a streamed level like our cave systems, drop it, and leave - it's going to stay behind, parented to the main map, and when that streamed level ceases to exist it will fall forever and be lost

By default all actors spawned at run-time are spawned into the 'overworld' though or rather whatever the main level is. The opposite is also true. If a streamed level has a cool axe in it and you bring it home, when that streamed level ceases to exist that axe is getting despawned.

So the question is, is there any way to do this currently with UE4?

Product Version: UE 4.14
more ▼

asked Dec 14 '16 at 04:04 AM in C++ Programming

avatar image

156 5 9 13

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

1 answer: sort voted first

There is two possible ways to reparent an actor:

  1. Just change a package of your actor using UObject's Rename method (It can change object's Outer). This method possibly can broke some registrations made by the SpawnActor function.

  2. Use SpawnActor to spawn your actor's clone inside the desired level and then remove old actor instance. To clone an actor you can specify your old actor as a template argument of SpawnActor. To select a new level you can use OverrideLevel. (You can use PersistentLevel as 'Overworld'. To access it just use GetWorld()->PersistentLevel )

But there is extra trouble with items lying on streaming levels. When your level will be loaded again all items you placed in the editor will be respawned because you can't and shouldn't save ingame changes on a disk. Usually these problems is solved by creating a special class "Prop" which just gives an actual item to a player, and all items is bounded to them player owner or inventory or something else which will survive between transactions. To prevent respawning items your prop class can request some persistant object which keep tracking eaten items. So, your crafted custom items just should never been streamed out.

more ▼

answered Dec 14 '16 at 10:57 PM

avatar image

1k 13 8 31

(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