How do you use "UnityEngine.Rendering.CullMode.Off"?

I know you can switch culling off using a shader, but it would be better to be able to just switch culling off through script than to have to make shaders that have culling set to Off. The Unity script reference mentions “UnityEngine.Rendering.CullMode.Off”, but gives little-to-no information about it or how to implement it.

Hey @Honorsoft

I came across your posting while Also looking for my own solution to doing this and figured out how CullMode works! You can see the forum that I used here link text.

As Glitchers has posted in the original forum using:

Shader "Example/CullControl" {
        Properties
        {
            [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 0
        }
        SubShader
        {
            Cull [_Cull]
        }
    }

in the shader allows you have create an accessible parameter in your shader (this only works on custom shaders you’ve created). This parameter can then be accessed through code as such:

rend.material.SetFloat("_Cull", 2);

once you have a reference to a renderer you can access that renderers material property and change the float value of the “_Cull” parameter. This leads back to the API info about Cull Mode and effectively it goes: 0 - No Culling, 1 - Front Face Culling, 2 - Back Face Culling.

Hope that helps!!