Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Unity 5

You're reading from  Getting Started with Unity 5

Product type Book
Published in May 2015
Publisher
ISBN-13 9781784398316
Pages 184 pages
Edition 1st Edition
Languages
Author (1):
Dr. Edward Lavieri Dr. Edward Lavieri
Profile icon Dr. Edward Lavieri

Optimizing scripts


We want our scripts to be optimal in regards to memory usage and processing. A great approach to script optimization is to simply code your game and run it with the Profiler window open and select the CPU Usage tab from the left pane, as shown in the following screenshot:

Using this view, you can see what processes are taking the most CPU power. The visual graph makes it easy to spot significant jumps in CPU usage. The Overview section, which can be found below the visual graph, provides a very detailed view of how much CPU processing is allocated to each object and process.

Another section of the Profiler window is the Memory tab. Reviewing that tab's information can tell you how much memory is allocated, how much system memory is used, and counts of Textures, Meshes, Materials, AnimationClips, AudioClips, Assets, and GameObjects:

Once we know where our problems or potential issues are, we can do a few things to optimize our scripts:

  • We can destroy objects that we no longer...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}