- Home /
OP solved his problem.
Difficulties in transfering data between levels
Hello everyone,
Right now I can transfer a gameobject between scenes by using the DontDestroyOnLoad. My problem is that I also have to transfer an int variable between levels.
Normally I thought at using PlayerPrefs.setInt. The problem I stumbled is that for the variable towerLvl, let's call it, I must assign a value to it the first time the level loads :
void Start(){
towerLvl = 0;
}
After that my tower increases in level so the value of the towerLvl variable changes from 0 to 1. Then it's when I save in PlayerPrefs the new value.
My problem is, how do I manage to use PlayerPrefs.GetInt without having collision with the variable declaration at Start ?
Hope I managed to explain accurately.
Nvm. I figured it out eventually. Question can be closed.
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Script help please 1 Answer
getting a variable from another script problem 1 Answer
How to execute a Skript global? 2 Answers