how to upgrade value in runtime and store it in player preff , so when user again open the game, value get updated ,
how to create a script which communicate with player preff and the updated game object inspector value
any one can suggest any way , i am trying to create upgrade weapon , through coin earn by player
here is a damage variable , you can see different with different guns but script is same , so i want to change this damage variable value , i tried with to create with static variable but it apply to all guns same value !
so if i am upgrading pistol so damage value of pistol will have to upgrade only , can anybody suggest ho to do that
Not to pile on but I agree with the posters above. The code is a wee bit out of control.
First thing: GET SOURCE CONTROL! Use git, commit your entire project to git. There’s plenty of great tutorials geared precisely towards git and Unity.
Now that it is in git, you have essentially a “save point” if anything goes wrong.
Now start to refactor, one step at a time, to break the code into related areas of concern.
Each time you pull something apart (see tutorials for how to) and test it to make sure it works, then commit ALL the changes that got you there (add files, modify files, delete files), and think of that as your new savepoint.
In all cases you always have every time you ever make a full commit to back up in case something goes wrong.
Don’t use static variables for things you want to be different between instances of the class. As for what you’re trying to do, I’m having difficulty finding where you’re trying to do it in your script. It is not necessarily bad to have some large scripts, but they need to be organized.