Rebuilding the inventory bar (example, equipping a backpack) after exiting a boat prints a Stale Component Reference.
Because OpenBoat of screens/playerhud does
self.controls.inv.boatwidget = self.controls.inv.root:AddChild(ContainerWidget(self.owner))
which is then closed when exiting a boat, but not detached from inventorybar class.
So, when doing this in Rebuild of widgets/inventorybar
if self.boatwidget then self.boatwidget:SetPosition(Vector3(700, do_integrated_backpack and 105 or 65, 0)) end
the widget isn't actually valid, but the reference exists, and so, SetPosition is called.
Putting
if self.boatwidget then if self.boatwidget.inst:IsValid() then self.boatwidget:SetPosition(Vector3(700, do_integrated_backpack and 105 or 65, 0)) else self.boatwidget = nil end end
stops the error and cleans the reference.
The clean way would be to make a CloseBoat method in the HUD and plug it into the Close of the container component, like how Open from container works with OpenBoat.
Steps to Reproduce
1) Spawn a row boat 2) Enter it 3) Exit it 4) Spawn backpack 5) Equip backpack 6) Check log
1) Spawn a row boat 2) Enter it 3) Exit it 4) Spawn backpack 5) Equip backpack 6) Check log
- 1
A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.