title: How to use FixedUpdate and Update properly?
body: <p>First, I'm new here, so I'm sorry if I make some noob mistake like not saying something that should be obvious like my unity version or whatever.
  (And this is my first post so I don't know how to use this, also I'm not English, so sorry for my bad English)</p>
  <p><strong>Unity Version: 2019.4.26f1 LTS</strong></p>
  <p>This is for a 2D project, but the doubt is global, for 2D and 3D.</p>
  <p>Anyway, I want to know how to separate my unity code (C#) properly.</p>
  <p>For example:
  Let's say that I want something like this: (I'm just using invented code to explain faster)</p>
  <pre><code>if(grounded &amp;&amp; PressKey(&quot;D&quot;))
  {
  rigibody2d.velocity = ...
  }
  
  if(!grounded &amp;&amp; PressKey(&quot;D&quot;))
  {
  rigibody2d.velocity = ...
  }
  </code></pre>
  <p>So for what I know, FixedUpdate must be used for physics, so how do I use</p>
  <pre><code>rigibody2d.velocity = ...
  </code></pre>
  <p>in a fixedUpdate, but the</p>
  <pre><code>if(!grounded &amp;&amp; PressKey(&quot;D&quot;))
  </code></pre>
  <p>in the Update?</p>
  <p>I only have one idea and is this:</p>
  <pre><code>private bool haspressedD = false;
  
  Update()
  {
      if(!grounded &amp;&amp; PressKey(&quot;D&quot;))
      {
        haspressedD = true
      }
  }
  
  FixedUpdate()
  {
     if(haspressedD)
     {
       rigibody2d.velocity = ...
     }
  }
  </code></pre>
  <p>And yes, this also looks horrible to me.</p>
  <p>I hope this example makes my doubt clear enough, you can ask if not.
  Another important thing is that I want to use FixedUpdate() because the speed feels different in my game if I change the computer, and yes I do:</p>
  <pre><code>rigibody2d.velocity = ... * Time.deltatime
  </code></pre>
  <p>With some movements work, but not for all of them.</p>
  <p>Any help will be appreciated</p>