- Home /
Help performance issues
I have a game I'm trying to optimize the performance and when i build the game, to test it after clicking the start button to change scene and play the game(from main menu to gameplay). so i checked the profiler to se what was slowing it down and it says loading.updatePreloading and it takes 90% of the cpu and take-up to 1000ms to load. it happens overtime i load the particular scene but not during the gameplay. so can someone please tell me whats wrong.
This isn't a solution to your problem but has anyone ever considered doing this:
public bool Debug$$anonymous$$ode = false;
public Countries $$anonymous$$yCountry = Countries.Canada;
public string PersonsName="Thamas Bell";
public int PersonsAge=29;
public string PersonsBirthday="Nov 11";
public enum Countries {
Africa,
Australia,
Brazil,
Canada,
China,
England,
France,
Japan,
Spain,
USA
}
[SerializeField]static string SName="";
[SerializeField]static int AAge="";
[SerializeField]static string SBday="";
[SerializeField]static bool fired=false;
public List"<"string">" $$anonymous$$yList = new List"<"string">"(){
string.Format("$$anonymous$$y name is: {0}", SName),
string.Format("$$anonymous$$y Age is: {0}", AAge.ToString()),
string.Format("$$anonymous$$y Birthday is: {0}", SBday),
string.Format("I live in {0}", $$anonymous$$yCountry.ToString()),
}
void Awake(){
SName=PersonsName;
AAge=PersonsAge;
SBday=PersonsBirthday;
Debug$$anonymous$$ode =GetDebug$$anonymous$$ode();
Debug.Log("Debug$$anonymous$$ode: " + Debug$$anonymous$$ode);
if(Debug$$anonymous$$ode){
Debug.Log("Hello World. How are you doing today?");
}
}
void Update(){
Debug$$anonymous$$ode =GetDebug$$anonymous$$ode();
if(Debug$$anonymous$$ode){
Debug.Log("Debug$$anonymous$$ode: " + Debug$$anonymous$$ode);
}
if(!fired){
for(int i =0; i< $$anonymous$$yList.Count;i++){
Debug.Log($$anonymous$$yList[i]);
}
fired=true;
}
}
public void SetDebug$$anonymous$$ode(Toggle enableToggle){
if(enableToggle.isOn){
PlayerPrefs.SetInt("Debug$$anonymous$$ode",1);
} else{
PlayerPrefs.SetInt("Debug$$anonymous$$ode",0);
}
}
public static bool GetDebug$$anonymous$$ode(){
int enable = PlayerPrefs.GetInt("Debug$$anonymous$$ode",1);
if(Equals(enable,1)){
Debug$$anonymous$$ode =true;
return Debug$$anonymous$$ode;
} else{
Debug$$anonymous$$ode =false;
return Debug$$anonymous$$ode;
}
}
Laid out in such a way as to be able to turn things off by a simple unity toggle. This same layout can be used for a number of things.
Notice how i made a debug mode to turn the calls on and off when unneeded. this helps in a final build nicely so no to make too many extra calls and when you need to debug you just have to tick off 1 variable on a main manager and vwala..just for each class make a debug mode and a get debug mode from PP's to get the variable of the one i made you to turn it on and off on awake in you main manager. I use PP's for this little thing so players can use it too by editing their player pref's file and then i add a debug console to my game. only enabled if debug mode is enabled. simple simple.
Your answer
Follow this Question
Related Questions
[Performance] RenderForwardAlpha performance issue on Android with Unity 5.3.0f4 0 Answers
UI performance on mobile. FPS drops 0 Answers
Calling gameobject.transform vs. just calling transform directly - Performance negligible? 1 Answer
Figuring out which specific objects are slow to render? 0 Answers