Search Unity

Question URP Decal Priority value via script?

Discussion in 'Scripting' started by megavezer, Dec 17, 2022.

  1. megavezer

    megavezer

    Joined:
    Nov 26, 2018
    Posts:
    1
    Hey guys!
    Is there a way to modify the priority value of a URP decal material? I want to basically render decals on top of another and vice versa, but I just cant find a way to access this value and modify it via script. I tried to modify the _DrawOrder material property, but I don't think it's the right one.

    upload_2022-12-17_17-55-54.png
     
    MiroslavShard and Carofi like this.
  2. Sphax84

    Sphax84

    Joined:
    Jun 23, 2015
    Posts:
    36
    Sorry to necroing this post but I'm looking for this exact thing... I can't find that "Priority" property anywhere in code and changing the material renderqueue instead doesn't work...

    EDIT: Infact I found how to change that. It's not documented anywhere but all Decal shader in URP have a "_DrawOrder" parameter and that is this parameter which corresponds to the exposed "Priority" in Inspector! Changing this parameter at runtime with decalMaterial.SetFloat will actually change the "Priority" property in inspector...
    Would be nice to document this on Unity side!

    As all my Google searches lead to here, I think this information is nice to be up to date here. ;)
     
    Last edited: Nov 27, 2023