congtrungvnit
congtrungvnit

Reputation: 665

When to use Application.targetFrameRate in Unity?

I'm new to game development and targeting mobile platforms. I don't know why and when we should use the Application.targetFrameRate to limit frame rate.

Upvotes: 2

Views: 8530

Answers (2)

zambari
zambari

Reputation: 5035

Use Application.targetFramerate when you want to limit its cpu/gpu use. By default it might eat up all the available cycles and try to push some ridiculous rates like 300fps. I often limit framerate to as low as 20 (below it stops being responsive) if I make i.e. an utility application (yes unity is not just for games) that I want to run alongside other applications and I don't want it behaving like a spoiled child and taking all the power to itself.

I also often use a very low limit like 1fps wen my app is not in the foreground to stop it from rendering even further.

As far as improving performance on a mobile device - this is not the way to go

Upvotes: 4

rasel raaz
rasel raaz

Reputation: 101

Create a game object in the first scene and attach a script named GameManager or what ever name you give. Then in Awake function use Application.targetFrameRate, and also create a static instance of this class and also use DontDestroyOnLoad for this game object.

Upvotes: 0

Related Questions