If an item is purchased from our shop scene, this will affect what happens to our game scene when our player's ship loads into the game. Our current PlayerSpawner script will not accommodate the shop scene ship, so we need to revisit this script to update its CreatePlayer method.
In the Unity editor Project window, locate and open the PlayerSpawnerscript(Assets/Resources/Script/PlayerSpawner):
- At the top of the PlayerSpawner script, with the other global variables, add a bool value:
bool upgradedShip = false;
The upgradedShip Boolean will switch to true if a modified player ship is found in the level.
- Scroll down to the Start function in the PlayerSpawner script and add this as the last line with the Start function:
GetComponentInChildren<Player>().enabled = true;
Currently, ourPlayerShipBuildscript disables thePlayerscript in theshopscene...