Unity loading settings: Application.backgroundLoadingPriority

Application.backgroundLoadingPriority:

This is a static attribute of the Application class, which can control the priority of the background loading thread, thereby controlling the time required for asynchronous loading of resources, and the impact on game performance during background loading.

Applicable APIs:

The asynchronous loading functions of loading objects ( Resources.LoadAsync , AssetBundle.LoadAssetAsync , AssetBundle.LoadAllAssetAsync ), scenes (Application.LoadLevelAsync, Application.LoadLevelAdditiveAsync) perform data reading and anti-realization on a separate background loading thread, and in the main thread object integration.

The integration time on the main thread is limited according to the backgroundLoadingPriority  value :
- ThreadPriority.Low - 2ms;
- ThreadPriority.BelowNormal - 4ms;
- ThreadPriority.Normal - 10ms;
- ThreadPriority.High - 50ms.

This is the maximum time an asynchronous operation can take in a single frame from the main thread.

The more time a single frame takes, the more data can be loaded, so the frame rate will drop, which will affect the game performance, but it can reduce the time to load resources and enter the game faster!

Conversely, the less time a single frame takes, the less data can be loaded, which has less impact on the game performance of the game, and it can have a good background loading when the game is in progress.

// Load as much data as possible, as a result frame rate will drop.
// Good for fast loading when showing progress bars.
//装载尽可能多的数据传输速率,因此帧将下降。 
//加载时显示出良好的快速进度条。
Application.backgroundLoadingPriority = ThreadPriority.High ;
 
// Load data very slowly and try not to affect performance of the game.
// Good for loading in the background while the game is playing.
//加载数据速度非常慢,尽量不影响游戏性能的。 
//在游戏进行时有很好的后台加载。
Application.backgroundLoadingPriority = ThreadPriority.Low ;

Guess you like

Origin blog.csdn.net/m1234567q/article/details/111242345