Best Practice For Player Stats Data
Hi
Currently i have put all the stats data which contains more than 10 long variable in one Class with name PlayerStats which is a Singleton, but i found little lag in game scene , Is there any Best Practice to maintain Player Stats.
Thanks in Advance!
Answer by Statement · Feb 16, 2016 at 12:57 PM
"10 variables" shouldn't cause lag. I assume they aren't textures you modify pixels of each frame, to put it into perspective.
Use the profiler to figure out what the bottleneck in your game is.
There are lots of approaches of accessing PlayerStats. Pick one that makes sense for you and that doesn't get in the way of developing your game. Maybe a singleton is what you want. If you find problems with using a singleton, adapt and create a new mechanism as needed.
Your answer
![](https://koobas.hobune.stream/wayback/20220612064241im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do switch scene with singleton pattern unity3d C# 2 Answers
Add object using other scene,Change something in scene from the menu 2 Answers
UNET Multiple online scenes 0 Answers
Saving an image's state 2 Answers
In the next scene tell player there score out of total using player prefab before next level 1 Answer