Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by videoanime · Feb 22, 2015 at 08:28 AM · updatefixedupdate

What's the difference between Update and FixedUpdate

I ask this because I have this code

 void Update ()
         {
         piso = Physics2D.OverlapCircle (gdchk.position, gdradius, 1 << LayerMask.NameToLayer("suelo")); //es un booleano que sera true o false si toca el suelo o no
 
         //Debug.Log (rigidbody2D.velocity.y);
         //if (piso || (Mathf.Floor(Mathf.Abs(rigidbody2D.velocity.y)) == 0 && transform.position.y < 7.1))
         //if (piso || (rigidbody2D.velocity.y == 0 && transform.position.y < 7.1))
         if (Mathf.Floor(Mathf.Abs(rigidbody2D.velocity.y)) == 0 && transform.position.y < 7.1)
             {
 //            Debug.Log (Mathf.Floor(Mathf.Abs(rigidbody2D.velocity.y)));
 //            Debug.Log (transform.position.y);
             //elemento.rigidbody2D.isKinematic = true;
             suelo = true;
             Semillero2.pieza = false;
             }
         //Debug.Log (suelo);
         }

with this code the last two variables are no receiving the values I want, but the same code with FixedUpdate instead, the value of the variables is received, why? What does Update and what does FixedUpdate do?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fafase · Feb 22, 2015 at 09:05 AM 0
Share

What two values? I don't see anything that would variate based on Update or FixedUpdate.

avatar image Owen-Reynolds · Feb 22, 2015 at 03:47 PM 0
Share

Searching for "unity update fixedupdate" will gives lots of explanations.

avatar image videoanime · Feb 22, 2015 at 08:20 PM 0
Share

I mean, the values for "suelo" and for "Semillero2.pieza", with FixedUpdate the assignment is respected and with FixedUpdate don't

avatar image felixmann · May 13, 2017 at 06:47 PM 0
Share

Great answer for this.

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by tanoshimi · Feb 22, 2015 at 08:32 AM

Update runs once every frame while the game is running. It runs at a variable rate, as often as your computer can process. It is the core of every game loop.

FixedUpdate runs once every iteration of the physics loop, which is an amount of time you set (say, 30 times per second, or 50 times per second). So it may be called more or less often than Update (), not necessarily in sync with it. It is used for physics calculations that need to be simulated at a certain rate to ensure consistency.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Could Update and FixedUpdate happen at the same time? 1 Answer

2D physics jump issue. 1 Answer

Climb animation in Update or FixedUpdate or LateUpdate?, 1 Answer

Rigidbody character and Update() function 1 Answer

InvokeRepeating OR Update OR FIxedUpdate? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges