Quantcast
Channel: Latest Questions by vptb
Viewing all articles
Browse latest Browse all 18

Static variable to check objects between scene reloads

$
0
0
Basically I have some items on the game which the player can pick up. When those items are picked they disappear. I also want it so that if the player dies, when the scene is reloaded, those items that he already picked up, won't spawn again. Standard procedure was to create a static List, which I add a picked object, and when the scene reloads the List will keep the information. My problem: 1st run - player picks up Object A. Object A is added to the list. 2nd run - when the scene starts the Object A checks if the list already contains himself, but it always returns false. Basically Object A in Scene X on run 1, is different from Object A in Scene X on run 2. Is there any way that I can relate those two objects? I tried with gameObject, with a MonoBehavior, with GetInstanceId(), but none of those worked.

Viewing all articles
Browse latest Browse all 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>