Announcement

Collapse
No announcement yet.

Any way to destroy dynamically spawned actors automatically on level unload?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Any way to destroy dynamically spawned actors automatically on level unload?

    I'm spawning some actors at runtime and I want them 'belong' to a level so that they get destroyed when the level is unloaded. Anyone know how to do that?
    Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

    #2
    One idea: Store a reference to these actors, then in GameInfo.GameEnding(), clean them up.

    Comment


      #3
      That's a good idea. Thanks. But I don't think that function would ever get called for me... when does GameEnding() get called? In my game, the player might be in a town level, and there the player would use a door, which streams in the castle map, where I might spawn an item that the player can pick up. But then if the player goes back to the town level (and unloads the castle level) without picking up the item, I'd like the item to get deleted. Does GameEnding get called every time you unload a streaming level?
      Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

      Comment


        #4
        Oh, I've never used level streaming. I imagine there must be some events from when a level is streamed in and out though...

        On a quick glance, there is this in PlayerController.uc:
        Code:
        final event LevelStreamingStatusChanged(LevelStreaming LevelObject, bool bNewShouldBeLoaded, bool bNewShouldBeVisible, bool bNewShouldBlockOnLoad )
        {
        ...
        }

        Comment

        Working...
        X