Verse push: components created before the push keep old code and fail casts to their own class

Summary

After Push Verse Changes, Verse components that were created before the push (here: an inventory_component subclass added under the player) stay in the scene with the old class version. They keep running the old code, and casts or FindDescendantComponents with the current class no longer find them. Only closing the Fortnite client removes them.

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

Steps to Reproduce

  1. In any UEFN project, set Island Settings to the default (Battle Royale) inventory, and create a Verse file repro_device.verse with this content:
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Itemization }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }

repro_bag := class(inventory_component) {}

repro_device := class(creative_device):
    OnBegin<override>()<suspends>:void =
        Print("repro v1")   # step 5: change this text
        for (Player : GetPlayspace().GetPlayers()):
            Bags := for (B : Player.FindDescendantComponents(repro_bag)) { B }
            All := for (I : Player.FindDescendantComponents(inventory_component)) { I }
            Print("repro_bag found: {Bags.Length}, inventories on player: {All.Length}")
            if (Bags.Length = 0, Root := GetRoot[Player]):
                BagEntity := entity{}
                BagEntity.AddComponents(array{repro_bag{Entity := BagEntity}})
                Root.Entity.AddEntities(array{BagEntity})
                Print("added a repro_bag")

    # The player's root inventory: the first child entity with an inventory_component.
    GetRoot(Player:player)<transacts><decides>:inventory_component =
        (for (C : Player.GetEntities(), I := C.GetComponent[inventory_component]) { I })[0]
  1. Build Verse, place one repro_device in the level, Launch Session, Start Game.
  2. Stop Game, Start Game (don’t push, don’t close the client).
  3. Stop Game.
  4. In the Verse file, change "repro v1" to "repro v2". Build Verse, Push Verse Changes, Start Game.
  5. Stop Game, Start Game (no push).
  6. Compare the Verse log lines of each match.

Expected Result

The existing bag is either removed together with the old code, or updated to the new class version, so FindDescendantComponents(custom_bag) still finds it.

Observed Result

  • FindDescendantComponents(custom_bag) finds 0, although the old bag is still under the player. The root inventory’s GetInventories().Length goes up by one with each push + restart (9 to 14 in one session).
  • Casting the old bag to custom_bag, or to an interface the class implements, fails.
  • The old bag keeps running the code it was created with. A newer version of the class declines pickups (OnReceive ignores find_inventory_event), but an older bag without that override kept taking picked-up weapons away from the weapon hotbar, while a current bag existed next to it.
  • Restarting the match doesn’t remove the old bags; only closing the Fortnite client does.

Workaround: at match start, remove every sub-inventory of the root that isn’t a fort_inventory_component (Inv.Entity.RemoveFromParent()).

Match Expected Observed
Step 2 found: 0, inventories: N → added same
Step 3 found: 1, inventories: N+1 same
Step 5 (after push) found: 1, inventories: N+1 found: 0, inventories: N+1 → added another
Step 6 found: 1, inventories: N+2? no: one bag found: 1, inventories: N+2, the old bag is still there but is no longer found as repro_bag

(N = 10 with the Battle Royale inventory: the root plus 9 sub-inventories.)

Platform(s)

PC, UEFN 43.10, edit session

Additional Notes

Only happens at edit-time (published islands don’t get pushes), but it makes type checks unreliable after every push and was very hard to track down.

Two documentation requests in the same area:

  1. Please document that entities/components a creator adds under the player survive match restarts (the player entity lives for the whole session), so creators have to clean them up themselves.
  2. Please document that a plain inventory_component subclass under the player bids for item pickups by default (it took weapons from the weapon hotbar without any OnReceive override), and how to opt out.