Search Unity

Timing with FixedUpdate

Discussion in 'Entity Component System' started by sstrong, Mar 27, 2021.

  1. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    I have a system that must keep in movement synch with regular PhyX moved objects. So, I use [DisableAutoCreation] and call Update() on my system from FixedUpdate().

    However, I think I have misunderstood Time.DeltaTime (previously Time.deltaTime in old versions of ECS). I have been using it like Time.deltaTime in monobehaviours. I think they are very different.

    In U2019.4 and Entities 0.11.0 it "appeared" similar ~ 0.02 seconds (sometimes more, sometimes a bit less). However, in U2020.3 and Entities 0.17.0, Time.DeltaTime is more like 0.007 to 0.01 - which obviously wreaks havoc with my DOTS movement code.

    Given I call Update() in my system from FixedUpdate(), should I be passing Time.deltaTime to my system and using that instead of Time.DeltaTime?

    BTW - the reason I don't use the newer FixedStepSimulationGroup is that I need the movement to be kept in step with the PhyX world, not just use the same step size.
     
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Yes, or you can use UnityEngine.Time.fixedDeltaTime to be more explicit.
     
    sstrong likes this.