Spawning and unspawning objects with MM Inventory System
Posted: Wed May 25, 2022 12:37 pm
I'm using the Dialogue System with More Mountains' TopDown Engine and Inventory System. Previously, thanks to an enormous amount of help from Tony Li, I was able to get inventories to persist between scenes:
https://www.pixelcrushers.com/phpbb/vie ... f=3&t=5849
My next task is to get picked up and dropped objects to persist between scenes. In other words, if I pick something up, I want it to be gone (although of course present in my inventory) if I leave the scene and come back. If I drop something, I want it to be there if I leave the scene and come back.
I started by following the instructions here:
https://www.pixelcrushers.com/dialogue_ ... nedObjects
This worked halfway. All of the objects that I drop are still there when I leave the scene and come back. The problem is that objects that I've picked up are also still there! Consequently, the player can make many clones of an object by picking it up and dropping it repeatedly, then leaving and returning to the scene.
I tried changing the Despawn Mode in the Spawned Object script attached to the object prefab to "On Disable". This doesn't seem to help.
I've noticed that the Inventory Engine can disable objects when they are picked up, but not destroy them. This leaves a lot of disabled objects lying around the scene.
Maybe this is an Inventory Engine problem -- I'll ask on their Discord -- but any help here would be appreciated.
https://www.pixelcrushers.com/phpbb/vie ... f=3&t=5849
My next task is to get picked up and dropped objects to persist between scenes. In other words, if I pick something up, I want it to be gone (although of course present in my inventory) if I leave the scene and come back. If I drop something, I want it to be there if I leave the scene and come back.
I started by following the instructions here:
https://www.pixelcrushers.com/dialogue_ ... nedObjects
This worked halfway. All of the objects that I drop are still there when I leave the scene and come back. The problem is that objects that I've picked up are also still there! Consequently, the player can make many clones of an object by picking it up and dropping it repeatedly, then leaving and returning to the scene.
I tried changing the Despawn Mode in the Spawned Object script attached to the object prefab to "On Disable". This doesn't seem to help.
I've noticed that the Inventory Engine can disable objects when they are picked up, but not destroy them. This leaves a lot of disabled objects lying around the scene.
Maybe this is an Inventory Engine problem -- I'll ask on their Discord -- but any help here would be appreciated.