Search Unity

Projector change color programmatically

Discussion in 'Editor & General Support' started by wokamoka, Feb 10, 2013.

  1. wokamoka

    wokamoka

    Joined:
    Jul 3, 2012
    Posts:
    10
    Hi all,

    I'm about to lose my mind because I cannot reach an objective.

    I need to programmatically change the color of the material attached to a Projector. (in fact the projector projects a colored circle at the bottom of my player).
    I used a Shader with a color defined as "_Color".

    I thought I would be able to access the material using :
    Code (csharp):
    1.  
    2. Projector proj = GetComponent<Projector>();
    3.         proj.material.SetColor("_Color", Color.green);
    4.  
    But Unity tells me that there is no material property attach to the projector.

    I read a lot of blogs and unity answer topics + unity documentation and so on.
    And I'm stuck to no solution.

    Please help me ;)

    Cheers !