- Home /
How to use one object selected from previous scene to the current scene ?
Hi All, I am working on a FPS game. I which my first scene in Main menu scene. Which is fine. In the second scene user is selecting the gun which he want to use (There are four guns). When he press play i am loading the new scene(gamePlay). How can i keep track of the gun which the user selected? so, he can use that gun in the gamePlay? its easy when you are working in a single scene by switching your camera. But how to do it in the new scene?
Answer by thinkwayne · Apr 03, 2014 at 12:50 PM
If this is something that does not happen frequently then its probably easiest to cache the values to disc before the scene changes and then read it back in on the new scene? In this situation you are only talking about 4 guns so you could have an enum value 1-4 representing each gun? You could have a persistance text file cache, for something this simple I would wrap it up in either JSON or CSV