Search Unity

Bug Compilation error in LegacyJointBakingSystem.cs when Physics engine module is disabled

Discussion in 'Physics for ECS' started by Spy-Master, Dec 17, 2022.

  1. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
    Unity 2022.2.1f1 and com.unity.physics 1.0.0-pre.15

    Library/PackageCache/com.unity.physics@1.0.0-pre.15/Unity.Physics.Hybrid/EntitiesBaking/BakingSystems/LegacyJointBakingSystem.cs(277,7): error CS1025: Single-line comment or end-of-line expected

    Library/PackageCache/com.unity.physics@1.0.0-pre.15/Unity.Physics.Hybrid/EntitiesBaking/BakingSystems/LegacyJointBakingSystem.cs(289,7): error CS1025: Single-line comment or end-of-line expected

    These are the two compiler errors that come up when the Physics module is disabled. This looks like it happens because one of the preprocessor directives in the file is matched to the #endif in block comments. For example:

    Code (CSharp):
    1. #if LEGACY_PHYSICS
    2.  
    3. ...
    4.  
    5. /*
    6. #if UNITY_EDITOR
    7.                 DstEntityManager.SetName(jointEntity, $"{baseName} ({joints[i].JointType})");
    8. #endif*/
    That is the #endif on line 289.
     
    JMPM-UNITY likes this.
  2. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    94
    @Spy-Master Thanks for reporting this. I'll file a report with your query and investigate it further.
     
  3. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    94
    Hey, @Spy-Master I have tried to reproduce this issue on my end but I cannot get to disable the Physics module since UPR has a dependency on it. See picture. Could you please send a zip file with your project? Thank you!
     

    Attached Files:

  4. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
    This repros with an empty project as attached (2022.2.3f1).
    The Physics module can be removed, triggering recompilation of Unity Physics and causing a compile error.
    Edit: still occurs on 2022.2.4f1.
     

    Attached Files:

    Last edited: Feb 1, 2023
    JMPM-UNITY likes this.
  5. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    94
    Thank you!
     
  6. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    94
    Hey @Spy-Master, I would like to inform you this bug has been fixed internally.
     
    Spy-Master likes this.
  7. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
    That is good to hear, thanks! I noticed 1.0.0-pre.44 is a bit more cavalier in assuming the engine module is installed (similar empty project makes ~40 errors this time), it will be a relief when we can safely cut away the modules and packages that we don’t want to depend on!
     
  8. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    94
    One of the things we realized while fixing this bug is that com.unity.render-pipelines.core now depends on physics module...
     

    Attached Files:

    Spy-Master likes this.
  9. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    639
    Oh. Right. That package also depends on UGUI for whatever reason. I suppose those packages and modules will have to stick around for Entities Graphics using URP or HDRP, then.
     
    JMPM-UNITY likes this.
  10. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    94
    Ideally, there should be no dependencies between physics and com.unity.render-pipelines.core.
     
  11. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    94
    You can not use E.G. with build in render pipeline. Only with URP or HDRP