0
votes

I really need help to figure out what happen in my game. I have try using Unity Profiler when game start. This is editor, But i see the Profiler especially for CPU Usage the graph chart is very high. You can check the picture below.

enter image description here

enter image description here

I don't know what cause this like this. But i am sure my game become slow and then sometimes slow in change scene load scene is because the graph is too high

So what could cause this ? What should i do ? What i need to do to reduce the graph to lower.

Thank You

1
You are doing something that's costing you 150 bytes each frame. I suggest you need "Deep Profile". You may be able to see what that is - Programmer
Could we see what script is that ? How to check what script is that ? - Dennis Liu
I believe you can. Enable "Deep Profile" like I said then expand Update.ScriptRunBehaviourUpdate and see if the function or script name is mentioned. See this and this post for how to use the profiler. - Programmer
Is that a big problem costing 150 bytes each frame ? - Dennis Liu
No, but if you have that script connected to multiple GameObjects then that would be a problem. Let's say it is attached to a prefab that is instantiated every once and then. - Programmer

1 Answers

1
votes

From @programmer discuss solution.

  1. Do not do something in update that costing 100 bytes or more, Imagine that if you have that script connected to multiple GameObjects then that would be a problem. Let's say it is attached to a prefab that is instantiated every once and then.
  2. Don't use lambda in the Update function. Avoid it at-all in Unity if you can.
  3. Edited : If possible try to avoid using FindIndex search at Update().

That's the suggestion from @programmer

For more information support check this :

Application.streamingAssetsPath and WebGL build

https://unity3d.com/learn/tutorials/topics/scripting/assetbundles-and-assetbundle-manager