How do you find Unity's frames/second?

I wanted to use Unity to create a small demo for a game I’d been designing, simply to test out the physics, but all of the physics-related writing I have done (movement speed, jumping height, etc.) are done in frames/second. I don’t know Unity’s framerate. I’m used to 2D games where you can set it. I’d planned on having the FPS set to 30, so all of my “Update()” code would run 30 times per second. I understand the “Time.deltaTime” use, but I don’t really want to rely on it. I want to use frames like I have everything written in my game’s design document. So can you specifically set a framerate, and if so, where/how do you do such a thing?

Also, I’d planned on using my in-game units as inches, but I also don’t know how much Unity moves with “transform.Translate”. Does it move 1 pixel if I use “transform.Translate(1,0,0)”? Or is it using some different measurement? Clarification would help a lot!

Thanks!

The first result in a search for ‘Unity3d fixed framerate’ already answers your question perfectly, I realize you’re new to this site but in the future please use the search function.

What you want to use here is Application.targetFrameRate. I don’t advice doing this however, as it’s far from a hundred percent reliable and means lag does not only affect how the game is ‘perceived’ but also how it’s actually run, and allowing for people to cheat by altering their frame-rate and faking lag.

You say you understand the concept of using Time.deltaTime, why don’t you want to rely on it? I see you’re new to 3D development, but I assure you this has absolutely now downside, only upsides.

If you however insist on doing everything in a fixed timestep, don’t use Update() but use FixedUpdate(). You can set the fixed time step for this function under Edit > Project Settings > Time > Fixed TimeStep. This means all physics calculations will also be run more or less frequently, so be careful with this. It’s also designed to ‘catch’ missed iterations, which it will que up and run if there was a moment’s lag due to a garbage collector spike for instance.

As for using inches for your in-game units, that’s completely up to you. The units Unity uses are only relative to eachother, so you can define them as you want to. The only place you have to tweak something is the gravity, as it’s by default set to -9.81, which implies meters/second. If you change that, or keep it in mind when using physics, you can just as well use inches/second_on_mars.

Good luck with your project and welcome to Unity :wink:

You cannot set the display framerate, simply because you cannot force a computer to go faster.

You can set the physics frame rate in ProjectSetting → Physics.

If you use something other than meters, you will need to change Gravity accordingly. A few things don’t work quite right with non-meter dimensions. One is the TreeCreator, which assumes meters given the limited unit ranges it allows.

Thanks for the answers,

Regarding some of the things said:

The first result in a search for ‘Unity3d fixed framerate’ already answers your question perfectly, I realize you’re new to this site but in the future please use the search function.

I searched Google for it a few times with various wording, but I kept getting things like “How to show the user’s framerate” rather than fixing the framerate specifically. The manual/reference didn’t seem to offer help either (not saying they’re bad documents because of that).

You say you understand the concept of using Time.deltaTime, why don’t you want to rely on it? I see you’re new to 3D development, but I assure you this has absolutely now downside, only upsides

The explanation (which isn’t very justified) was that in my GDD, some things (such as jumping) would move X units/frame for 18 frames…I guess I’ll just translate them into seconds instead of frames.

EDIT-Sorry, forgot something:

Something I don’t understand, however, is what a ‘meter’ is, specifically. Sorry, I’ve gotten used to moving things by pixels in 2D games (X + 10 would be 10 pixels to the right), but Unity seems to do things differently. I don’t really understand how the gravity would relate to this…? Is the gravity the amount of pixels each meter takes you?

Thanks again for the help!