4. How to use the profiler in Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video is about using the profiler in unity  the profiler is a system/ a software that Unity   provides so that you can analyze your game frame  by frame let's take a look at it to open up the   profiler you have to go to the window analysis and  click on the profiler I already got it back here   and the profiler let me just maximize this  profiler has different Windows different sections   CPU usage rendering memory audio and so on and  so forth and each of each of them provides you   with the details of usage of CPU or GPU memory  and Etc to actually get this data you're going   to have to run your game once so I will just  run my sample project once and get this data   so I run my project and got some data here let's  analyze it here in the CPU usage if I click and   drag my mouse I can see that I I will be able to  analyze each frame as you can see in the top here   I'm currently in the frame 8442 and in this Frame  I can see in the hierarchy view I can change this   view of course I can make it like a timeline it  shows all the methods that are run in a timeline   kind of window or I can use it in the hierarchy  and in this frame for example I can see how much   CPU or memory each method has used and using  this information I can optimize my methods or   change them or remove them so let's take a look  at this peak here and see what's taking so much   CPU as you can see it's the editor Loop that's  taking a total of 98 percent of this process here   if I take a look around here for example  I can see it's about 71 percent but   in this peak it's taking up 98 percent so the  editor Loop is actually the the processes that   are being run by the Unity's editor itself so it's  nothing much that you need to be worried about   because in your final project when you export your  game this process overhead will not exist however   what's interesting here is this player Loop  if I open it up and take a look at it you just   drag this up all right I will be able to see  all my scripts that are being run in the game   and for example camera render is taking up  about 0.5 percent of my CPU power and I can   see that my update methods are taking up about  0.5 percent of the CPUs of my update methods are   kind of kind of complex and I have this field of  view dot update which is using physics 2D raycast   and this is the field of view of my AI in this  game in this uh sample game and I know that it   takes as you can see it takes about 420 calls to  the physics 2D raycast and it's a complex method   but I need it so I can't just maybe I can  optimize the code change the algorithm a bit   but I know that I expect this method to  be complex to be taking up some CPU power   um but it's a good thing to be aware of  these things going down to this next section   I will jump to the memory section because it's an  important one if I click on it and just go to a   frame like this around maybe this peak here I can  see that down here I have a totally used memory   of one gigabyte-1.2 gigabytes and it will tell me  how much each of the assets of my game is taking   up space you have to be careful here because the  profiler itself is taking up some space and also   this is the memory that your game is using while  it's in the editor so in reality it will take a   kind of less memory than what you're seeing  here but it's a good thing to keep a look out   for there are other sections like physics that or  the network messages that you can take a look at   if your game is a multiplayer game but the next  interesting thing here is the UI I think and you   will see in the UI section that if you if you've  got a complex UI you're showing the user so many   things you will see that the rendering here as  you can see the render here is blue if I turn it   off you can see the layout itself is not taking up  much of the performance but the rendering is kind   of heavy and you have to be careful about what  you're going to render and show to the user each   frame if you think that your UI is getting too  complex you have to take a look at the UI here   so that's about it about the profiler just keep in  mind that the two most important things that you   probably be using is the CPU usage and the memory  section apart from that you can play around with   it see what data each section gives you and what  are some of the deep analysis that it can provide   but apart from that just keep in mind that  these two sections are the most important ones
Info
Channel: Learn with Iman
Views: 1,914
Rating: undefined out of 5
Keywords: unity, gamedev, learngamedev, learnunity
Id: rlC30sr4ugA
Channel Id: undefined
Length: 6min 48sec (408 seconds)
Published: Mon Jan 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.