Object Instantiation after scene change c++

Object Instantiation after scene change c++
0.0 0


Hello, I have an abstract class with two different types of objects derived from it, Id like the user to select which object in the previous scene to use.

Just now I have two image buttons, when user selects ship one that should be the ship used in game or same with ship 2, but im having problems with how to do this while calling Director Replace scene in the ShipSelectorScene?. I Instance an object in the GameScenes Init Method. Any advice would be appreciated.



Just store some variable which distinguish the ship. In the ShipSelectorScene alter that variable and in the GameScene use it to instantiate a proper ship.


Im unsure how that would work after replacing a scene? I was doing some reading and I think I need to go down the singleton route, but Im unsure when I instantiate this so that everywhere in the game has access to it.