- Home /
Question by
SuperRaed · Sep 29, 2018 at 05:41 AM ·
playerprefsscene-loadingselection
character selection across scenes
how can I take the player's choice in one scene e.g a character from character selection menu and instantiate it in another scene? do I make use of the playerprefs?
Comment
Answer by LCStark · Sep 29, 2018 at 08:29 AM
You can use a static class to store data between the scenes.
EDIT
Storage class:
public static class Data {
public static int selectedCharacterID;
}
Scene1:
void Character1Click() {
Data.selectedCharacterID = 1;
}
void Character2Click() {
Data.selectedCharacterID = 2;
}
Scene 2:
void Start() {
Debug.Log(Data.selectedCharacterID);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612175435im_/https://answers.unity.com/themes/thub/images/avi.jpg)