Skip to content

PhysicsSettingsOps.cs: Physics2D.autoSyncTransforms is obsolete in Unity 6.x (CS0618) #1091

@PersistentWorldGames

Description

@PersistentWorldGames

Summary

Packages/com.coplaydev.unity-mcp/Editor/Tools/Physics/PhysicsSettingsOps.cs reads and writes the deprecated Physics2D.autoSyncTransforms property in two places, producing CS0618 warnings on Unity 6.x.

Versions

  • MCP for Unity: 9.6.8
  • Unity: 6000.3.10f1 (Unity 6.3 LTS)

Compiler output

Packages/com.coplaydev.unity-mcp/Editor/Tools/Physics/PhysicsSettingsOps.cs(62,46): warning CS0618: 'Physics2D.autoSyncTransforms' is obsolete: 'Physics2D.autoSyncTransforms has been deprecated please use Physics2D.SyncTransforms instead to manually sync physics transforms when required.'
Packages/com.coplaydev.unity-mcp/Editor/Tools/Physics/PhysicsSettingsOps.cs(284,25): warning CS0618: 'Physics2D.autoSyncTransforms' is obsolete: 'Physics2D.autoSyncTransforms has been deprecated please use Physics2D.SyncTransforms instead to manually sync physics transforms when required.'

Locations

  • Line 62 — get path: autoSyncTransforms = Physics2D.autoSyncTransforms inside the 2D snapshot returned by the get action.
  • Line 284 — set path: Physics2D.autoSyncTransforms = prop.Value.Value<bool>(); inside the "autosynctransforms" case of the 2D set switch.

Suggested fix

Unity removed the auto-sync property in favor of an explicit Physics2D.SyncTransforms() call. A few reasonable shapes:

  1. Drop autoSyncTransforms from the 2D snapshot and from the set switch entirely. Add an action like manage_physics { dimension: "2d", action: "syncTransforms" } that simply calls Physics2D.SyncTransforms().
  2. Keep the public field name for back-compat in the response but report autoSyncTransforms = false as a fixed value, and turn the setter into a no-op that logs a deprecation note. Add the explicit-sync action alongside.
  3. Wrap both lines in #pragma warning disable CS0618 / restore if the intent is to keep mirroring the legacy property until the Unity API is fully removed.

Same situation likely applies to Physics.autoSyncTransforms (3D) — worth checking when patching.

Impact

Warnings only, not errors. The 2D manage_physics path still works on Unity 6.x because Unity hasn't removed the property yet, only deprecated it. Filing now so the fix lands before Unity removes the API outright.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions