SlideShare a Scribd company logo
1 of 26
Spotlight Case Study:
Finding where your memory
goes
Story Time
Test Case
• International Font Support
• Changing UI
• Added to the Shooter Demo
• Dynamic uGUI elements
Test Case
• International Font Support
• Changing UI
• Based on the Shooter Demo
• Dynamic uGUI elements
• That… allocates ~1kb per frame
Spoiler Alert
• Limit regular UI alterations that cause layout to dirty
• Pool anything you spawn
• Have different pools for different kinds of things
William Armstrong
Spotlight Programmer
Unity
Step One: The obvious
• TextMeshPro
• Canvas Organization
• Memory Pool
Correct Step One: Profiling
Correct Step One: Profiling
Memory Profiler
• Good sanity check
• Don’t trust the numbers
• Do use their relative size
Correct Step One: Profiling
Step Two: Source
• UGUI – Bitbucket
https://bitbucket.org/Unity-Technologies/ui
• Package Manager
C:Users<user_name>AppDataLocalUnitycachepackagespackages.unity.com
• Everything Else
https://github.com/Unity-Technologies/UnityCsReference
Shameless Plug
• Guid Based Cross Scene References
https://github.com/Unity-Technologies/guid-based-reference
Step Two: Source
Step Two: Source
Step Two: Source
Step Two: Source
Step Three: Victory
Double Checking
Double Checking - 2017
Double Checking - 2018
UI Profiler
Going Deeper
• Xbox One PIX
• PS4 Razr
• Nvidia Nsight
• iOS Instruments
• Android Profiler
Result!
Lessons Learned
• Profiler Driven Optimization
• Use our Source Code
• Fixed size UI - Avoid recalculating layouts
• Use memory pools
Questions?
williama@unity3d.com

More Related Content

What's hot

MMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européen
MMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européenMMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européen
MMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européenInstitut de l'Elevage - Idele
 
Raspberry Pi Technology
Raspberry Pi TechnologyRaspberry Pi Technology
Raspberry Pi TechnologyRavi Basil
 
MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...
MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...
MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...Institut de l'Elevage - Idele
 
Introduction to raspberry pi
Introduction to raspberry piIntroduction to raspberry pi
Introduction to raspberry pipraveen_23
 
SOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevage
SOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevageSOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevage
SOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevageInstitut de l'Elevage - Idele
 
программное обеспечение1.pptx
программное обеспечение1.pptxпрограммное обеспечение1.pptx
программное обеспечение1.pptxssuser609fa4
 
Introduce to AM37x Sitara™ Processors
Introduce to AM37x Sitara™ ProcessorsIntroduce to AM37x Sitara™ Processors
Introduce to AM37x Sitara™ ProcessorsPremier Farnell
 
Video Streaming
Video StreamingVideo Streaming
Video StreamingVideoguy
 
GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...
GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...
GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...Institut de l'Elevage - Idele
 
Image and Video formates
Image and Video formatesImage and Video formates
Image and Video formatesPrerak Shirpur
 
Intro to Multimedia Systems
Intro to Multimedia SystemsIntro to Multimedia Systems
Intro to Multimedia Systemsjunliwanag
 
Image capture powerpoint
Image capture powerpointImage capture powerpoint
Image capture powerpointcbottomleyct
 
Multimedia composition
Multimedia composition Multimedia composition
Multimedia composition Sakshi Shakya
 
MMX2023 Viande - Evolution de la production et des exportations océaniennes b...
MMX2023 Viande - Evolution de la production et des exportations océaniennes b...MMX2023 Viande - Evolution de la production et des exportations océaniennes b...
MMX2023 Viande - Evolution de la production et des exportations océaniennes b...Institut de l'Elevage - Idele
 
Le marché de la viande ovine boosté par de faibles disponibilités
Le marché de la viande ovine boosté par de faibles disponibilitésLe marché de la viande ovine boosté par de faibles disponibilités
Le marché de la viande ovine boosté par de faibles disponibilitésInstitut de l'Elevage - Idele
 
Presentazione torre eiffel Serena Bellomonte es 4
Presentazione torre eiffel Serena Bellomonte es 4Presentazione torre eiffel Serena Bellomonte es 4
Presentazione torre eiffel Serena Bellomonte es 4serenabellomonte
 

What's hot (20)

MMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européen
MMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européenMMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européen
MMX2023 Viande - L'Espagne, acteur de l'évolution du marché intra-européen
 
Raspberry Pi Technology
Raspberry Pi TechnologyRaspberry Pi Technology
Raspberry Pi Technology
 
Hdmi
HdmiHdmi
Hdmi
 
MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...
MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...
MMX2022 - Marchés mondiaux des produits laitiers - rétrospective 2021 et pers...
 
Introduction to raspberry pi
Introduction to raspberry piIntroduction to raspberry pi
Introduction to raspberry pi
 
SOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevage
SOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevageSOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevage
SOMMET 2023 Agrivoltaïsme, comment garantir le maintien de l’activité d’élevage
 
программное обеспечение1.pptx
программное обеспечение1.pptxпрограммное обеспечение1.pptx
программное обеспечение1.pptx
 
Introduce to AM37x Sitara™ Processors
Introduce to AM37x Sitara™ ProcessorsIntroduce to AM37x Sitara™ Processors
Introduce to AM37x Sitara™ Processors
 
Video Streaming
Video StreamingVideo Streaming
Video Streaming
 
Video
VideoVideo
Video
 
Raspberry pi
Raspberry pi Raspberry pi
Raspberry pi
 
Multimedia System
Multimedia SystemMultimedia System
Multimedia System
 
GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...
GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...
GAL2023 - La Nouvelle-Zélande, une production laitière sous contraintes envir...
 
Image and Video formates
Image and Video formatesImage and Video formates
Image and Video formates
 
Intro to Multimedia Systems
Intro to Multimedia SystemsIntro to Multimedia Systems
Intro to Multimedia Systems
 
Image capture powerpoint
Image capture powerpointImage capture powerpoint
Image capture powerpoint
 
Multimedia composition
Multimedia composition Multimedia composition
Multimedia composition
 
MMX2023 Viande - Evolution de la production et des exportations océaniennes b...
MMX2023 Viande - Evolution de la production et des exportations océaniennes b...MMX2023 Viande - Evolution de la production et des exportations océaniennes b...
MMX2023 Viande - Evolution de la production et des exportations océaniennes b...
 
Le marché de la viande ovine boosté par de faibles disponibilités
Le marché de la viande ovine boosté par de faibles disponibilitésLe marché de la viande ovine boosté par de faibles disponibilités
Le marché de la viande ovine boosté par de faibles disponibilités
 
Presentazione torre eiffel Serena Bellomonte es 4
Presentazione torre eiffel Serena Bellomonte es 4Presentazione torre eiffel Serena Bellomonte es 4
Presentazione torre eiffel Serena Bellomonte es 4
 

Similar to Garbage Free UI: A Spotlight Team Case Study

Developing AR and VR Experiences with Unity
Developing AR and VR Experiences with UnityDeveloping AR and VR Experiences with Unity
Developing AR and VR Experiences with UnityMark Billinghurst
 
External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1) External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1) Volkan Özçelik
 
Automated Visual Regression Testing by Dave Sadlon
Automated Visual Regression Testing by Dave SadlonAutomated Visual Regression Testing by Dave Sadlon
Automated Visual Regression Testing by Dave SadlonQA or the Highway
 
A Taste of Monitoring and Post Mortem Debugging with Node
A Taste of Monitoring and Post Mortem Debugging with Node A Taste of Monitoring and Post Mortem Debugging with Node
A Taste of Monitoring and Post Mortem Debugging with Node ibmwebspheresoftware
 
A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...
A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...
A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...Jan Aerts
 
CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!
CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!
CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!Joseph Labrecque
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)Sauce Labs
 
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...NCCOMMS
 
External JavaScript Widget Development Best Practices
External JavaScript Widget Development Best PracticesExternal JavaScript Widget Development Best Practices
External JavaScript Widget Development Best PracticesVolkan Özçelik
 
Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012Volkan Özçelik
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conferencedmethvin
 
Five Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal SiteFive Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal SiteMediacurrent
 
Keep calm and write reusable code in Android
Keep calm and write reusable code in AndroidKeep calm and write reusable code in Android
Keep calm and write reusable code in AndroidJuan Camilo Sacanamboy
 
Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007
Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007
Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007Jason Hong
 
#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with DartGDGKuwaitGoogleDevel
 
Development Processes and Tooling
Development Processes and ToolingDevelopment Processes and Tooling
Development Processes and ToolingBora Bilgin
 
Two Scope of Django 1.6 Chapter 20 and 21
Two Scope of Django 1.6  Chapter 20 and 21Two Scope of Django 1.6  Chapter 20 and 21
Two Scope of Django 1.6 Chapter 20 and 21Gu-yuan Lin
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Applitools
 

Similar to Garbage Free UI: A Spotlight Team Case Study (20)

Developing AR and VR Experiences with Unity
Developing AR and VR Experiences with UnityDeveloping AR and VR Experiences with Unity
Developing AR and VR Experiences with Unity
 
External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1) External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1)
 
Automated Visual Regression Testing by Dave Sadlon
Automated Visual Regression Testing by Dave SadlonAutomated Visual Regression Testing by Dave Sadlon
Automated Visual Regression Testing by Dave Sadlon
 
A Taste of Monitoring and Post Mortem Debugging with Node
A Taste of Monitoring and Post Mortem Debugging with Node A Taste of Monitoring and Post Mortem Debugging with Node
A Taste of Monitoring and Post Mortem Debugging with Node
 
A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...
A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...
A Kanterakis - PyPedia: a python crowdsourcing development environment for bi...
 
CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!
CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!
CrunchBuddy: Server-based Video Transcode for AMS with Adobe AIR!
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
 
External JavaScript Widget Development Best Practices
External JavaScript Widget Development Best PracticesExternal JavaScript Widget Development Best Practices
External JavaScript Widget Development Best Practices
 
Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
 
Five Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal SiteFive Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal Site
 
Keep calm and write reusable code in Android
Keep calm and write reusable code in AndroidKeep calm and write reusable code in Android
Keep calm and write reusable code in Android
 
DjangoSki
DjangoSkiDjangoSki
DjangoSki
 
Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007
Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007
Phinding Phish: An Evaluation of Anti-Phishing Toolbars, at NDSS 2007
 
#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart
 
Development Processes and Tooling
Development Processes and ToolingDevelopment Processes and Tooling
Development Processes and Tooling
 
Two Scope of Django 1.6 Chapter 20 and 21
Two Scope of Django 1.6  Chapter 20 and 21Two Scope of Django 1.6  Chapter 20 and 21
Two Scope of Django 1.6 Chapter 20 and 21
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 

More from Unity Technologies

Build Immersive Worlds in Virtual Reality
Build Immersive Worlds  in Virtual RealityBuild Immersive Worlds  in Virtual Reality
Build Immersive Worlds in Virtual RealityUnity Technologies
 
Augmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real worldAugmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real worldUnity Technologies
 
Let’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and moreLet’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and moreUnity Technologies
 
Using synthetic data for computer vision model training
Using synthetic data for computer vision model trainingUsing synthetic data for computer vision model training
Using synthetic data for computer vision model trainingUnity Technologies
 
The Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global IndustriesThe Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global IndustriesUnity Technologies
 
Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games Unity Technologies
 
Unity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator ToolsUnity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator ToolsUnity Technologies
 
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...Unity Technologies
 
Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019Unity Technologies
 
Turn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiencesTurn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiencesUnity Technologies
 
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...Unity Technologies
 
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...Unity Technologies
 
QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019Unity Technologies
 
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...Unity Technologies
 
Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...Unity Technologies
 
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...Unity Technologies
 
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...Unity Technologies
 
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Unity Technologies
 
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019Unity Technologies
 
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019Unity Technologies
 

More from Unity Technologies (20)

Build Immersive Worlds in Virtual Reality
Build Immersive Worlds  in Virtual RealityBuild Immersive Worlds  in Virtual Reality
Build Immersive Worlds in Virtual Reality
 
Augmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real worldAugmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real world
 
Let’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and moreLet’s get real: An introduction to AR, VR, MR, XR and more
Let’s get real: An introduction to AR, VR, MR, XR and more
 
Using synthetic data for computer vision model training
Using synthetic data for computer vision model trainingUsing synthetic data for computer vision model training
Using synthetic data for computer vision model training
 
The Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global IndustriesThe Tipping Point: How Virtual Experiences Are Transforming Global Industries
The Tipping Point: How Virtual Experiences Are Transforming Global Industries
 
Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games Unity Roadmap 2020: Live games
Unity Roadmap 2020: Live games
 
Unity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator ToolsUnity Roadmap 2020: Core Engine & Creator Tools
Unity Roadmap 2020: Core Engine & Creator Tools
 
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
How ABB shapes the future of industry with Microsoft HoloLens and Unity - Uni...
 
Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019Unity XR platform has a new architecture – Unite Copenhagen 2019
Unity XR platform has a new architecture – Unite Copenhagen 2019
 
Turn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiencesTurn Revit Models into real-time 3D experiences
Turn Revit Models into real-time 3D experiences
 
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
How Daimler uses mobile mixed realities for training and sales - Unite Copenh...
 
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
How Volvo embraced real-time 3D and shook up the auto industry- Unite Copenha...
 
QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019QA your code: The new Unity Test Framework – Unite Copenhagen 2019
QA your code: The new Unity Test Framework – Unite Copenhagen 2019
 
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
Engineering.com webinar: Real-time 3D and digital twins: The power of a virtu...
 
Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...Supplying scalable VR training applications with Innoactive - Unite Copenhage...
Supplying scalable VR training applications with Innoactive - Unite Copenhage...
 
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
XR and real-time 3D in automotive digital marketing strategies | Visionaries ...
 
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
Real-time CG animation in Unity: unpacking the Sherman project - Unite Copenh...
 
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...
 
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
What's ahead for film and animation with Unity 2020 - Unite Copenhagen 2019
 
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
How to Improve Visual Rendering Quality in VR - Unite Copenhagen 2019
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 

Recently uploaded (20)

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

Garbage Free UI: A Spotlight Team Case Study

Editor's Notes

  1. Good news! You don’t have to keep living with your garbage.
  2. Earlier this year we took a trip to Seoul. We were talking to lots of clients and potential clients, seeing what they were doing, trying to find the next great Unity Game to shine our Spotlight on. Almost every team we talked to had the same problem. They were displaying lots of text on screen, mostly player names floating above their character heads. Nametags in an MMO. These were causing lots of performance issues, mostly having to do with Garbage Collection. As names changed and players wandered into and out of view, the changing UI would generate garbage, cause Garbage Collection, and cause major performance hits. I found myself giving the same advice to all of these teams. Best practices, how to think of this problem, what specific tools they should look at. Over and over this same advice, broken down into small bits. Back and forth over the specific details. Memory Pools, TextMeshPro, Signed Distance Fields, how to profile. At every company. For every game. Through a translator. Thousands of dollars to send our team out there, thousands more in salary sitting there in these meetings, taking a huge chunk of time to fix the same problem over and over again. When I got back to SF, I decided to build that use case myself, and go through the steps of solving it. Mostly because I wanted to make sure that I had told everyone the right thing. But I also wanted to go through the process, make myself slow down and think about how I learned to solve garbage issues, and how to teach our users, you, here, now, to do this for themselves. I am going to walk us through how I broke this use case down and show you how to find and destroy your own memory allocation issues. I’m going to cover some technical specifics of the problem, but I am going to focus on the methods for tracking the problem area down and how to think of solutions, not just how to render a nametag efficiently. Though, you will all be able to do that too.
  3. First things first, I needed a test case. Given the sensitive nature of many of our projects, I had to make one myself. To start, I did things the most obvious way. I took our old friend the Sample Shooter, and added nametags to all the enemies. I added these to the Prefabs we were already spawning, each with their own canvas. To simulate new players, with different names, coming into and out of vision, I decided to swap out the language of the enemy names rapidly, switching between Korean and English. This hit all the problems that our clients were facing.
  4. I glanced at the Profiler briefly to make sure we were seeing the same problems that our Clients were reporting. Sure enough, this solution was allocating 22.2 kb every time we spawn something, 12.7 kb of that seems to be coming from UI at a glance. Worse, we are also seeing over 1 kb of per frame allocations when we aren’t spawning anything. This is generating a ton of garbage that will have to be collected. I don’t know if you’ve heard this, but Unity’s Garbage Collector… could be better.
  5. Spoiler Alert – we are going to get rid of our per frame allocations entirely The bulk of the allocations came from UI Layout Group recalculating every frame. Avoid regularly altering the Rect Transfrom of any thing that resizes your Layout Group or has a parent with a Content Size fitter
  6. Introduce self and the spotlight team
  7. Best Practices for Memory Instantly, I set off doing the exactly wrong thing. I know a bunch of tricks to save memory and performance so just started doing them. TextMeshPro Performs better and looks better than old school atlas based fonts. Only requires a single signed-distance-field atlas to generate good results at all resolutions. Hooked that up. Fed in a nice free adobe font with support for the Korean character set, rasterized to a SDF, and had it generate a single texture for all my characters. Ended up being a 4k texture because there are a lot of characters needed. Pooling Made a pool to spawn all name tags as a child of a shared canvas. I remembered that any time anything on a Canvas dirties, the whole thing has to update, so you want to group your UI into dynamic and static Canvases or Canvas Groups. Spawning things from prefab is slow, so lets pre-allocate a pool. This also lets me only show the name tags for characters on screen, rather than needing a nametag for every character everywhere. If you don’t know the term, Pooling is building a shared resource ahead of time, your pool, and then pulling resources out and returning them as they are needed. This lets you load and instantiate a type of object well ahead of needing it. In this case, I made a simple class that just pre-allocates a list of GameObjects that holds all my UI, and has some simple logic for keeping track of which GameObject is my next Deactivated one. There are lots of good Asset Store solutions you can buy, and great examples of this code online. I highly recommend taking a moment and getting comfortable with a nice generic pooling solution early in every project. If you pool things by default, you will have much greater control of your memory usage as your game grows. I do all of that, wasn’t very hard, should be good now, so open up the profiler and…
  8. Fire up the profiler, sort by allocation and… its still bad. Really should have looked at this first. While everything I did helped, it was not the most bang for buck. As you are trying to optimize your own projects, every change counts. Always profile first. Don’t be like me.
  9. Quick Trick – turn off Vsync to get more readable profiling results for CPU Usage
  10. In this case I am concerned with per frame allocations, not total memory. But I might as well take a look, make sure there isn’t anything crazy. You get to the memory profiler by selecting the memory graph up top, picking a frame you want to look into, switching to detailed mode, and then hitting the Gather Object Re Here is a my one giant Text Mesh Pro texture. Hmm, takes up more memory than the default texture atlas solution. Looks better though, and supports more features. If I made the default look this good, it would take up more memory too. All my pooling didn’t touch the total memory usage, but did lower the per frame, so I will take that win.
  11. Back to our per frame allocation problem You can see here we are getting these allocations from some Unity function Canvas.SendWillRenderCanvas() I know Canvas is a Unity class, I didn’t write it, and I don’t know what this code does. Lets fix that.
  12. Now that I know I have a problem, and know some information about where it is coming from, I can try to track down the source of the issue. Literally. We have several places you can find Unity source code these days. These are just some examples. Lots of good stuff gets added to our Github there.
  13. As an example, I just made a new small tool available on GitHub myself. A little utility that lets you set up GUIDs for game objects and then reference them even if they are in another scene.
  14. LayoutGroup.OnRectTransformDimensionsChange() looks like the problem. To the code! base.OnRect.. Is empty, not it. Problem must be in SetDirty(). That already lets us know we might be able to work around this problem by not changing rect transform dimensions or doing anything else to dirty the layoutgroup. But lets dig in and see if the memory is going somewhere sensible. I see a StartCoroutine, which those always allocate memory. But only a little. I dig in a bit deeper.
  15. Hmm, an Initialize() function. Those quite often set up memory. In this case, it is copying a RectTransform struct, and looks like it is doing some boxing. Not great, but not obviously wrong either. Looking into the rest of the function calls, we have an internal registration function.
  16. That is doing a couple of searches on a Queue and some more boxing. Again, not ideal, but not obviously broken either. So this memory usage seems appropriate. There is not a major bug in here that we can fix in the UGUI code to remove all the allocations. So we need to work around it. We know that all this allocating code gets called from the OnRectTransfromDimensionChange callback, and that is nicely named. What is causing us to change our transform dimensions? I am pooling all the UI, so it could be when I first turn one on, but that would lead to spikes, not constant per-frame allocation.
  17. So it must be something I am doing every frame. Which, for this test case, is translating the name plates between English and Korean every frame. That causes the text to resize. LayoutGroup is the big clue! I have a content size fitter on there matching the backing faceplate. Since these are names, and we already set a fixed size on those, there is no reason to not just standardize the backing image. I only did it this way on a lark anyway. So lets go turn off the content size fitter, set our text to best fit, and see what we get.
  18. No allocations! Ok, almost no allocations. 90 bytes are coming from some other UI code, but that could be a GetComponent in editor or a string concatenation or something. 90 bytes is a huge improvement though!
  19. All of this was done in our old friend Unity 5.6. How many here are still on the 5.x family? On the spotlight team we see all sorts of projects, on every version of Unity. I wanted to double check my findings and make sure this was consistent across more modern versions of Unity. They hold steady. In 2017 and 2018, altering an uGUI layouts bounds will cause these kind of allocations.
  20. I wanted to double check my findings and make sure this was consistent across more modern versions of Unity. They hold steady. In 2017 and 2018, altering an uGUI layouts bounds will cause these kind of allocations. This also gave me a chance to look at my solution in the UI Profiler, added in 2017
  21. The UI Profiler is a special purpose profiler similar to the Frame Debugger but just for UI. Looking at my solution it looks… not great. You can see here, we are getting 2 draw calls per nameplate. The UI Profiler is very similar to our Frame Debugger, but focused on UI. It will show you how your UI is batching and give you hints about why a batch gets broken. In this case, it is telling me that the objects I am rendering have different Material Instances. Which is true, since it is drawing the Nametags and Text in order, switching between those two materials. This is due to them being able to stack on top of each other. Canvas Renderers are drawn in order from top to bottom in the Heirarchy and that is the order they are sorted in for occlusion. Since we want the names to be occluded by nametags in front of them, we need to leave this ordering alone. So while I don’t see a great way to improve this draw call performance, I at least know where my batches are going.
  22. All of our built in Profiling tools are great for finding the low hanging fruit. If you are allocating kb a frame, it is easy to do better than that. You should always drop into these tools first, they are integrated, easy to use, and will let you know where to focus your early efforts. However, none of our generic tools can really tell you what is going on your specific hardware. For that, you need more customized tools. PIX on XBox, Razr on Sony, every platform has their own version. Our generic tools are great for knowing, relatively, what areas of your code are the problem. But they are not build to get accurate absolute measurements. Don’t focus too much on how many milliseconds our profiler is saying you spend. Just find the places that are the most expensive and make them cheaper.
  23. Here is where we started - ~12 kb of UI allocations on every monster spawn. ~1 kb of garbage generated every frame. Here is where we are now. 0 and 0. This still isn’t perfect. Ideally, we would be pooling our AI before spawning them just like we pool their nametags. When pooling complex prefabs, like an AI, always be sure to Profile as you go. Some internal systems perform better when disabled rather than de-activated. For example, Animators free all their scratch memory when the GameObject they are part of is Deactivated. But not if the Animator is Disabled. If you are pooling and unpooling Animators rapidly, you might be better off disabling every Component than Deactivating the GameObject entirely. The reason I care so much about per-frame allocation is that Garbage Collection is quite expensive. While work is ongoing under the hood to improve that, it will never be free, or even fast. As your game scales, the GC algorithm has to look at every Object to make sure that everything you have is still needed. By keeping your per frame allocations low, or zero, you can increase the time between GC hitches and have your game keep performing well as it scales up.
  24. Use the Profiler. Don’t just assume you know where your memory is coming from. Look at our code. Between bitbucket, github, and Package Manager, more and more of our code is available to you. Use it. Don’t alter the Rect bounds of a Layout Group every frame. It allocates memory. Make a pool. Don’t allocate on demand, allocate ahead of time.