Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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:
    177
    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.
     
    JosepMariaPujol likes this.
  2. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

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

    JosepMariaPujol

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    77
    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:
    177
    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
    JosepMariaPujol likes this.
  5. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    77
    Thank you!
     
  6. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    77
    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:
    177
    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. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    77
    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:
    177
    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.
     
    JosepMariaPujol likes this.
  10. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

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

    JosepMariaPujol

    Unity Technologies

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