Search Unity

Default Material in Physics Manager: How it is supposed to work?

Discussion in 'Physics' started by MenteBacata, Jun 14, 2018.

  1. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi everyone,
    setting the default material property in the physics manager seems to have no effect.
    The documentation says:
    So i would expect that every collider with material set to 'none' would have assigned the default material I specified in the physics manager, but it doesn't work that way.
    After hitting play all unassigned materials are still 'none' and if i try to access them via script I get the Default (Instance) material which is not what I set as default material.
    This isn't something I noticed just now (I'm on Unity 2017.4.3f1), I rember having the same issue back on Unity 5, but now I have reached a point in my project where this feature would really come in handy.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    I presume you're talking about 2D physics?

    Anyway, it doesn't mean it physically assigns the material but rather than the Rigidbody2D or Collider2D uses the default material.

    The way it works is that a Collider2D looks to see if it has a material assigned and uses it if so. If not it looks to see if the Rigidbody2D it is attached to has a material assigned and uses that if so else it uses the default material on the physics manager. It does not copy the material and assign it to the property.
     
  3. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Actually I was talking about 3D physics, however I think I got it now.
    Still I think there is an issue:
    When a script reads a collider's material which is unassigned, it automatically assigns 'Default (Instance)' to the material property which is different from the default material set in the physics manager and then the physic properties of the collider are changed.
     
  4. laurencew

    laurencew

    Joined:
    Jul 24, 2012
    Posts:
    7
    @MelvMay I am also seeing this behaviour, where the assigned "Default Material" in the physics manager isn't assigned to 3d colliders instantiated at runtime. Is this feature 2d-only now?
     
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    Oh okay, I can only speak for 2D physics. For 3D physics @yant would know more.
     
  6. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    No problem, thanks anyway.
     
  7. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Can you see any properties that are different in the default (instance) material compared to the one described in the physics properties? If yes, report. I remember there were a few some years ago and we fixed that. Thanks.
     
  8. MenteBacata

    MenteBacata

    Joined:
    Dec 20, 2016
    Posts:
    49
    Hi,
    yes, properties are all different. It seems that the default (instance) material is the unity default one.
     
  9. Quasimodem

    Quasimodem

    Joined:
    May 21, 2013
    Posts:
    52
    Hello, I am seeing similar problems now that I've updated to 2018.3.1f1. Furthermore, it seems that editing ANY physic material during runtime seems to give very strange behavior. It almost behaves as if any modifications are actually applied to the material I have specified as default, but also makes the rest of my materials suddenly start working as I expect them to.

    Outside of this, my physic materials seem semi-randomly broken, it's very hard for me to tell what's going on... just lots of sliding and bouncing where things we working as expected with 2017.