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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved URP/Material Change 'Render Face' at Runtime, programmatically

Discussion in 'Unity Reflect' started by opacicpetar96, Dec 22, 2020.

  1. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Hello!

    I would like to change the Render Face property of the materials that uses the Universal Render Pipeline. Now I know how to do this in the Inspector but I would like to access this property from code and change values at runtime. (For example, from Front to Both).
    The property:
    renderface.PNG

    Any ideas?
     
  2. Gublu

    Gublu

    Unity Technologies

    Joined:
    Dec 17, 2020
    Posts:
    9
    Hi,

    You can achieve that by setting the material value "_Cull". Exemple:

    Material mat = [set your TestMat here];
    mat.SetFloat("_Cull", (float)CullMode.Off);
     
  3. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Thank you @Gublu , this solved the issue! :)