Search Unity

Trying to access a shader property - Silhouette Outlined Diffuse

Discussion in 'Shaders' started by henmachuca, Oct 28, 2016.

  1. henmachuca

    henmachuca

    Joined:
    Oct 14, 2016
    Posts:
    95
    Hello

    I have downloaded the Silhouette Outlined Shader from wiki to add an Outline Shader for my gameobjects.
    I am trying to access its properties to change them dynamically during run time.

    I have the code below but it is not working.

    Any advices on how to do it?

    Code (CSharp):
    1.     public Renderer outline;
    2.  
    3.     void Start () {
    4.         Renderer outline = GetComponent<Renderer>();
    5.         outline.material.shader = Shader.Find("Outlined/Silhouetted Bumped");
    6.     }
    7.  
    8.     void Update () {
    9.         float test = Mathf.PingPong(Time.time, 0.1f);
    10.         outline.material.SetFloat("_Outline", test);
    11.     }
    12. }
     
unityunity