1

My game has a scene that has the option to select the character, but when I go to the other scene I can't get references from the previous scene, so how do I know which character was chosen from the previous scene and put to appear in the new one?

enter image description here

Lin Du
  • 88,126
  • 95
  • 281
  • 483
Tio Mob
  • 15
  • 5

1 Answers1

0

welcome to Stack Overflow!

Unity provides a cool thing called PlayerPrefs, and it also saves on your local disk when you leave. Here's an example of a game I made using PlayerPrefs: infinitecarspeeder.netlify.com. I would make a method when you hit the button, it sets a PlayerPref named skin:

PlayerPrefs.SetString("ChosenSkin", "Josh");

If you do not want your player's skin to save when you leave:

PlayerPrefs.DeleteKey("ChosenSkin");

For more info, see this link: https://docs.unity3d.com/ScriptReference/PlayerPrefs.html

Hope it helps!

randomcoder
  • 626
  • 7
  • 20