Hello there,
In my game, monsters drop items when killed. These items are obviously instantiated across all connected players (TNManager.Create()) in order for them to see it on the ground. Now when a players goes to pick it up, a clone of the item is made first (GameObject.Create()) and put into their inventory, then the original item is destroyed across all connected players (TNManager.Destroy()) so that no one can pick it up again.
Now the problem occurs when the player who pick up the item tries to drop it onto the ground again. Obviously, the item will need to be instantiated across all connected players again to be visible (TNManager.Create()). However, this throws an error as the item is not the same item prefab that's originally referenced in the TNManager item array (remember that it was cloned). The item also already has a TNObject script with a unique id on it. How would I about solving these two problems?
I'm doing the above method instead of just disabling and then enabling when the item is visible/not visible without destroying/creating for performance reasons. Players can have 50 or so items in their inventory, so having a lot of connected player without the above mentioned method means keeping a lot more GameObjects than they need to.
Thanks!