playMaker

Author Topic: Set Target Frame Rate  (Read 8033 times)

derkoi

  • Full Member
  • ***
  • Posts: 187
Set Target Frame Rate
« on: October 11, 2012, 03:20:07 PM »
In Unity, the default is set at 30fps, for weeks I've been trying to get over 30fps thinking it was my optimisations. I discovered this and it improved my frame rates.

To use this action, put it on a gmaeobject in the first scene in your game and set it to 60.  :)

Sid

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Set Target Frame Rate
« Reply #1 on: July 29, 2014, 10:02:59 AM »
Updated this, as it was not working.  It's great for testing various framerates.

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Device)]
[Tooltip("Sets the target frame rate")]
public class TargetFrameRate : FsmStateAction {

    [RequiredField]
public FsmInt intValue;

public override void Reset()
{
intValue = 30;
}

// Code that runs on entering the state.
public override void OnEnter()
{

Application.targetFrameRate = intValue.Value;
Finish();
}


}
}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Target Frame Rate
« Reply #2 on: August 04, 2014, 07:14:59 AM »
Hi,

 I added this action to the Ecosystem and made an entry in the Rss Feed. Thanks for your contribution guys :)

 Bye,

 Jean

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Set Target Frame Rate
« Reply #3 on: December 03, 2017, 05:29:40 AM »
Hi guys, is this supposed to work in build only? I've put it in the scene and the stats gizmo shows way over that number. I need fixed frame rate for some stuff that's depending on float values and/or every frame.
« Last Edit: December 04, 2017, 09:00:43 AM by krmko »
Available for Playmaker work

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Set Target Frame Rate
« Reply #4 on: December 04, 2017, 10:17:55 AM »
according to the docs it should affect the game window, but I get mixed results
https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Set Target Frame Rate
« Reply #5 on: December 04, 2017, 02:33:24 PM »
Hi,
What are you trying to do?

It is not a good idea to use frame rate for manipulating certain values.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Target Frame Rate
« Reply #6 on: December 05, 2017, 12:49:06 AM »
Hi,

 You should indeed animate using Time.DeltaTime which guarantee consistent behaviour regardless your device  performances and FPS.

 Target FPS make sure it doesn't go above, but can not guarantee it will not be lower, obviously because the devices is not powerful enough.

 Bye,

 Jean

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Set Target Frame Rate
« Reply #7 on: December 09, 2017, 06:51:13 AM »
Thanks Jean.
Available for Playmaker work