forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInitializeSamples.cs
More file actions
21 lines (18 loc) · 918 Bytes
/
Copy pathInitializeSamples.cs
File metadata and controls
21 lines (18 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using Unity.Entities;
using UnityEngine;
// This class sets the upper limit of FPS of a demo that is being run.
// It is used as a workaround for JobTempAlloc issues on CI and to make
// measuring performance easier.
public class InitializeSamplesSystem : SystemBase
{
protected override void OnCreate()
{
// Currently, JobTempAlloc is raised also when a job takes more than 4 frames to complete, independent of allocation.
// Setting the target frame rate to 60 means giving each frame more time to complete, therefore the jobs would complete in less than 4 frames.
// Also, since FPS will be lower, there will be more frames with physics in them making perf measurements easier.
Application.targetFrameRate = 60;
// Disabling updates because the system has nothing to do in OnUpdate method
Enabled = false;
}
protected override void OnUpdate() {}
}