Tony Li wrote: ↑Fri Sep 22, 2023 8:34 pm
Hi,
Is an Apple in the scene at design time? If so, you could remove the Spawned Object component and only add a Destructible Saver. Set a unique key.
If the player can pick up and drop Apples arbitrarily, it doesn't need a Destructible Saver. Set the Spawned Object component's Despawn Mode to OnDestroy if you actually destroy the GameObject when the player picks it up. Set Despawn Mode to On Disable if you deactivate the GameObject when the player picks it up. Also make sure you have only one Spawned Object Manager in the scene.
If that doesn't work, are there any errors or warnings in the Console window?
Ah right, the Apple that already exists in the scene just needs a Destructible saver, that solved that!
But for the duplicate issue, I've sent you a YouTube link via PM so you can see the details on the components and what's happening, I believe I'm doing everything by the book but as is often the case I'm probably doing something wrong.
I'm saving and loading with ES3, and I've tried using the ES3 Prefab component and not using it, nothing changes.
It only creates instances with the Spawned Object Manager component enabled.
One thing I didn't capture in the video is that if I pause the Editor and run it frame by frame during the load sequence, one Apple gets instantiated after 1 frame as I set it to be in the Save System component, but then another one gets instantiated in the next frame. Yet this only happens with Spawned Object Manager component enabled, with it off, nothing gets instantiated.