Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started 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. :)
-
Updated this, as it was not working. It's great for testing various framerates.
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();
}
}
}
-
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
-
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.
-
according to the docs it should affect the game window, but I get mixed results
https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html
-
Hi,
What are you trying to do?
It is not a good idea to use frame rate for manipulating certain values.
-
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
-
Thanks Jean.