I read these two threads
- Another bug? Item duplication when changing scenes - #7 by piwakawaka
- Another bug with the portals' saving parts - #4 by Ayeng_AE
and I am not sure I understand why the problem only seems to happen to Pickups spawned by the PickupSpawner and not the ItemDropper. Both seem to use the item’s destruction (i.e. is it null) to determine its state but only the Pickup Spawner exhibits the bug for me. Brian’s fix in one of the threads also seems to only modify the PickupSpawner code and not pickups dropped by the ItemDropper.
The issue seems to be with GetComponent() / GetComponentInChildren() which maybe has more stale information??
But why rely on this nuance? If the underlying root cause is that we cannot use the gameObject’s destruction (or non-destruction) to determine state, wouldn’t the correct solution be to modify the Pickup script such that it keeps track of its own state? Asking so that we can be better prepared to avoid future bugs.