Search Unity

turning off autoSyncTransform is your friend

Discussion in 'Physics' started by laurentlavigne, Jul 29, 2020.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    I've been stuck in 4.7 land for so long that I missed this new setting.
    In the profiler today it was sucking up 0.3ms, which becomes 3ms on the Switch so I turned it off and everything worked like nothing changed, minus the 0.3ms.
    No idea in what scenario I'd want it. I move agents either by navmesh or directly, physics objects are moved by .AddForce and gravity.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    It's off by default in new projects. It isn't automatically turned off for you when you upgrade a project because it'd change your projects behaviour i.e. the huge amount of devs who do modify Transforms when they shouldn't.

    This "sync" behaviour was kind of forced onto the physics systems because the changes to the Transform system meant we no longer got callbacks when they changed internally. This changed a long time ago to facilitate much higher performance of Tranforms and to ensure no side-effects when modifying them in Jobs.

    Personally I'd like to see it off and break projects forcing correct behaviour i.e. not changing Transforms then querying however for many that'd be too much of a breaking change and potentially costly on large projects.
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    hopsefully navmesh is updated before the physics loop
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    It's a
    Behavior
    , so I believe it falls in the normal undefined execution order for
    Component
    classes. Probably not an issue for you unless you require Physics to update every tick.