Challenge - Optimize the Project Scripts

Tutorial

·

intermediate

·

+0XP

·

10 mins

·

(48)

Unity Technologies

Challenge - Optimize the Project Scripts

In this tutorial, you will use the Profiler window to determine where you can improve a scripts performance.

1. Identifying the Problem

1. Use the Profiler to identify a problematic performance
a. Open the Profiler in Unity, by going to Window > Analysis > Profiler.
b. Play the game and observe the performance profile using Deep Profile if necessary
c. Identify the AI Behavior as a hindrance to performance

b4e85fdc-7320-4e00-b6e4-de9ae0c38fd5_image7.png

d. Record the profile data to use as a baseline (never optimize without a baseline)

2. Optimizing the Script

1. Optimize the AI Behavior
a. Open the SimpleAI script
b. Determine the problematic section of the code

170dd49d-a611-4052-b8b0-327bc3105993_image15.png

c. Fix the code section by commenting out the culprit

f7ac1701-dcd0-47a7-b853-4e60f13c772b_image4.png

3. Analyzing the Result

1. Use the Profiler to analyze the results
a. Open the Profiler in Unity
b. Play the game and observe the performance profile
c. Compare to your benchmark

0dd652de-17c3-4d47-ad18-eb04ff84ccd3_image3.png

Complete this tutorial