Disabled Physics Components vs. Removed Physics Components

Hi all,

I have an unexpected behaviour regarding the Physics Body GO component. I have a Physics Body component on a vehicle that causes it to drop due to its PhysicsMass ECS component.

When I start the game with a disabled Physics Body GO component, my assumption was that it would not convert to a PhysicsMass ECS component, but it does (see first half of the GIF). Only when I remove the PB GO component is the ECS component not created (second half of the GIF).

5149595--510056--disabled-components.gif

Is my assumption correct in that it should not create an ECS component for its entity?

Cheers and thanks in advance

P.S: I'm aware that this could as well go into the DOTS forum, but I think the physics authoring components are managed by people reading this forum.

P.P.S: Never mind the weird colors when the game runs, that is an issue with the URP that I have yet to figure out.

P.P.S: Just noticed this should have gone into the DOTS Physics forum (https://forum.unity.com/forums/dots-physics.422/) – sorry about that.

Yes that is weird. That setup should not result in a PhysicsMass component being created.
FWIW I just tried the same thing here in the sample scenes and it behaves as expected.

Agreed, this is weird. Would it be possible to get a repro of your scene running in the Samples project?

Making stuff up of the top of my head here: Is this a prefab in the inspector, while we are looking at an instance with the enable flag overriden? Is there a parent GO with another Physics Body component? Do you have your own conversation system in operation? Is the prefab a dependency on a script somewhere else that converts it first?

Is the graphics material using a ShaderGraph? If so, you might want to try disabling GPU instancing as a short term fix. We had that issue on the samples when we moved to 2019.3.x

Thanks to both of you for confirming that a PhysicsMass ECS component should not be created.

I forgot letting you know the Unity version. It's 2020.1.0a11 on OS X.

To answer @steveeHavok 's questions (starting from the 2nd):
1. It's an instance of a prefab. The Physics Body component is disabled while in the prefab (not visible) it's enabled.
2. No, this is the top level GO with the Physics GO component.
3. I have some conversion systems, but not for Physics GO components – I use the Convert To Entity GO component.
4. Not sure what that exactly means – I use conversion scripts to convert some of my own authoring components.

To test this I now tried with a fresh project – and started with a non-prefab cube and a prefab cube. Both have this issue (GIF with the same procedure as in the last GIF):

5151347--510344--disabled-components-2.gif

Here's the manifest:

UnityPhysicsBodyTest $ cat Packages/manifest.json
{
  "dependencies": {
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.ads": "2.0.8",
    "com.unity.analytics": "3.3.2",
    "com.unity.collab-proxy": "1.2.16",
    "com.unity.ext.nunit": "1.0.0",
    "com.unity.ide.vscode": "1.1.3",
    "com.unity.physics": "0.2.4-preview",
    "com.unity.purchasing": "2.0.6",
    "com.unity.render-pipelines.universal": "7.0.1",
    "com.unity.rendering.hybrid": "0.1.1-preview",
    "com.unity.test-framework": "1.1.5",
    "com.unity.textmeshpro": "2.0.1",
    "com.unity.timeline": "1.3.0-preview.3",
    "com.unity.ugui": "1.0.0",
    "com.unity.xr.management": "3.0.3",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}

I am slightly confused as to which sample scene/Samples project you are talking about. Should I submit the new project depicted in the GIF as a case?

Re the shader graph question:
I was using a standard URP lit material with textures on it, no special shader graph (by me).
In the GIF above, I am using the default URP Lit shader with no textures, and disabled GPU instancing.

Please let me know if there's anything I can provide to help.

I've submitted a minimal reproduction as case 1197207.

1 Like

Sadly, the answer I got has nothing to do with the minimal case I submitted (afaics) – not sure if this case now is followed up or in limbo…?

[quote=“steveeHavok”, post:3, topic: 764713]
If so, you might want to try disabling GPU instancing as a short term fix. We had that issue on the samples when we moved to 2019.3.x
[/quote]

Quick update re the above part - I reproduced it, and it appears that the culprit is the SRP Batcher:
https://discussions.unity.com/t/765792

Thanks for all the support! :slight_smile:

1 Like

In 2020.1.a14 with Entities 0.2.0, the disabled Physics Body GO component does not result in a PhysicsMass component anymore. Thanks!

2 Likes