Out of curiosity, why do we need to spawn pickups through a PickupSpawner instead of just placing the pickup gameobjects into the scene?
The items we are using are scriptable objects (InventoryItem
) and can’t be placed in the world. For this reason we have a spawner that can be placed in the world, and it takes this scriptable object and loads the pickup based on that scriptable object. We work with the InventoryItem
and not the game object, so we need to have that detail when we ‘pick up’ the item.
You actually could put a pickup directly into the scene, but you will lose the ability to determine if the pickup has been picked up when you save the game or transition between scenes… If you simply place the pickup, then every time you go back to the scene, the pickup will be back. This is a nice setup for an exploit (where you could pick up items forever, and sell them at the shop keepers and never need to worry about coin again).
I wrote a bunch of stuff regarding the saving system’s requirement but for the life of me couldn’t remember exactly what it was, so I deleted it again. Now that I’ve seen your post @Brian_Trotter, I vaguely remember it had to do with the object no longer being in the scene when it’s picked up and then the saving system would not get an ISaveable
for it, so nothing would be saved. When you load the scene again, this object will exist, and the saving system will not be able to remove it because it has no idea that it existed to begin with.
Pretty much sums it up
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.