+ All Categories
Home > Technology > Shades of Play: Code Analysis/Unity Performance Tips

Shades of Play: Code Analysis/Unity Performance Tips

Date post: 13-Apr-2017
Category:
Upload: rainer-angermann
View: 1,549 times
Download: 0 times
Share this document with a friend
12
Code Analysis by Rainer Angermann @rangermann [email protected] www.shadesofplay.at
Transcript
Page 1: Shades of Play: Code Analysis/Unity Performance Tips

Code Analysis by

Rainer Angermann @rangermann

[email protected]

www.shadesofplay.at

Page 2: Shades of Play: Code Analysis/Unity Performance Tips
Page 3: Shades of Play: Code Analysis/Unity Performance Tips

Static Code Analysis

• Gendarme

• Unity rules

https://github.com/fderudder/unity-gendarme

Page 4: Shades of Play: Code Analysis/Unity Performance Tips

GetComponent() Calls

• Cache your components!

• Avoid GetComponent() calls in Update()

• Avoid this:

Page 5: Shades of Play: Code Analysis/Unity Performance Tips

Empty MonoBehaviour Methods

• Avoid this:

• Overhead!

Page 6: Shades of Play: Code Analysis/Unity Performance Tips

Profiler

Page 7: Shades of Play: Code Analysis/Unity Performance Tips

Sounds

• Avoid this:

• Suggestion:

Page 9: Shades of Play: Code Analysis/Unity Performance Tips

Profiler: Comparison

Page 10: Shades of Play: Code Analysis/Unity Performance Tips

General Advice

• Code style/readability (format your code!)

• Use English for all names etc.

• Do not be afraid of refactoring/renaming

• Use a portrait resolution if your game is portrait

• MonoBehaviour/inspector: Use private members with [SerializeField]

• Unity Console (errors/warnings)

Page 12: Shades of Play: Code Analysis/Unity Performance Tips

Questions?

Rainer Angermann @rangermann

[email protected]


Recommended