Unlike the main frame update, Unity’s physics system updates at a fixed time interval, which is important for the accuracy and consistency of physics simulations. The interval between fixed updates is often referred to as the fixed timestepA customizable frame-rate-independent interval that dictates when physics calculations and FixedUpdate() events are performed. More info
See in Glossary. You can read or change the fixed timestep in two ways:
Time.fixedDeltaTime
property .In both cases the fixed time step is specified in seconds. For example, a value of 0.01 means each fixed time step is one hundredth of a second in duration, so there are 100 fixed updates per second.
The fixed update loop simulates code running at fixed time intervals but in practice the interval between fixed updates isn’t fixed. This is because a fixed update always needs a frame to run in and the duration of a frame and the length of the fixed time step are not in perfect sync. If a fixed time step completes during the current frame, the associated fixed update can’t run until the next frame. When frame rates are low, a single frame might span several fixed time steps. In this case a backlog of fixed updates accumulates during the current frame and Unity executes all of them in the next frame to catch up.
Note: There is a maximum timestep period beyond which Unity will not attempt to catch up with the simulation. For more information, refer to Handling variation in time.
Unity provides the MonoBehaviour.FixedUpdate
method as an entry point for you to execute your own code on each fixed update. This is most commonly used for executing your own physics-related code, such as applying a force to a RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary.
You can see more details of what occurs during the fixed update cycle in the Physics section of the execution order diagram diagram.
If your application runs at a higher frame rate than the number of fixed time steps per second then the average frame duration is less than the duration of a single fixed time step. In this case, each frame has one fixed update or none at all. For example, if the fixed time step value is 0.02, there are 50 fixed updates per second. If your application runs at 80 frames per secondThe frequency at which consecutive frames are displayed in a running game. More info
See in Glossary, a fixed update occurs every two or three frames, as shown below.
This diagram shows the frame rate running faster than the fixed update timestep rate. Time progresses to the right, each frame is numbered, and shows its Update
call at the start of the frame in orange. The fixed timestep here is 0.02 seconds (50 times per second), and the game is running faster, at about 80 frames per second. In this situation there are some frames with one fixed update call, and some frames with none, depending on whether a full fixed update timestep has completed by the time the frame starts. The fixed time step periods are marked with letters A, B, C, D, E, and the frames in which their corresponding fixed update calls occur are marked in green. The fixed update call for timestep A occurs at the start of frame 4, the fixed update call for timestep B occurs at the start of frame 7, and so on.
If your application runs at a lower frame rate than the fixed timestep value then the average frame duration is longer than a single fixed timestep. This means a backlog of fixed updates can accumulate during some frames and so each frame has one or more fixed updates to allow the physics simulation to catch up with the backlog. For example, if the fixed timestep value is 0.01, there are 100 fixed updates per second. If your application runs at 40 frames per second, Unity performs an average of two or three fixed updates per frame to keep up. You might want a scenario like this when it’s more important to model more accurate physics than to have a high frame rate.
This diagram shows what happens when the fixed update cycle is running faster than the frame rate. The fixed timestep here is 0.01 seconds (100 times per second), and the game frame rate is running slower, at about 40 frames per second. In this situation most frames have multiple fixed update calls before each update call, the number depending on how many whole update timesteps have elapsed since the previous frame. The fixed update time step periods are marked with letters A, B, C, and so on, and frames in which their corresponding fixed update calls occur are marked in green. The fixed update call for timestep A and B occurs at the start of frame 2, the fixed update call for frames C, D & E occur at the start of frame 3, and so on.
Note: A lower timestep value means more frequent physics updates and more precise simulations, which leads to higher CPU load.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.