Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: derkoi on October 11, 2012, 03:20:07 PM

Title: Set Target Frame Rate
Post by: derkoi 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.  :)
Title: Re: Set Target Frame Rate
Post by: Sid 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();
}


}
}
Title: Re: Set Target Frame Rate
Post by: jeanfabre on August 04, 2014, 07:14:59 AM
Hi,

 I added this action to the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) and made an entry in the Rss Feed (http://feeds.feedburner.com/PlaymakerEcosystem). Thanks for your contribution guys :)

 Bye,

 Jean
Title: Re: Set Target Frame Rate
Post by: ... 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.
Title: Re: Set Target Frame Rate
Post by: terri 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
Title: Re: Set Target Frame Rate
Post by: djaydino 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.
Title: Re: Set Target Frame Rate
Post by: jeanfabre 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
Title: Re: Set Target Frame Rate
Post by: ... on December 09, 2017, 06:51:13 AM
Thanks Jean.