So you're in Unity 5, with lots of cool new features! In this video we're going to look at using performance profilers. I'm building a ten pin bowling game and one of the things we are doing is regularly making a call to 'FindObjectsOfType' method. So if I look for a pin I do a FindObjectsOfType and this gets called every single frame because of the way the code is structured.
So it that really slow? We don't have to guess any more with Unity 5, simply:
- Run your game
- Go to the Window menu
- And then the profiler drop down
- Once the profiler pops up just search for the script name (in my case it's PinSetter) and there you go, two different entries for the PInSetter.
- You can see that the PinSetter's update cycle, which is the thing I was worried about, is taking .1 of a millisecond. Now a script that takes less than 10 milliseconds is pretty fast for us indie game developers so we're happy with that!
And there you go, just wanted to show you how to use the Performance Profiler in Unity 5.
Enjoy! And if you want to join over 22,000 other students learning indie game development,
then check out our course on http://www.CompleteUnityDeveloper.com.
Our online video game development school uses the amazing free game development tool, Unity 5, and has something for both beginner & intermediate students. So join today and get ready to deploy on Android, Steam, iOS, Web, PS4, Xbox and more...