- Home /
ShaderGraph Material Color change.
Hello,
I made a ShaderGraph Shader, that I applied to a material. In the SHader, I put in "public" a variable Color in order to change the material color. From the inspector, it do work if it is not runtime ;

I would like to change this material color depending on different elements during the game. The Material is applied to a lineRenderer. I tried many ways, but it never change color ;
GetComponent<EnemyType>().color; return a RGBA color. I tried : 
 LaserLine.material.color = GetComponent<EnemyType>().color;
 LaserLine.startColor = GetComponent<EnemyType>().color;
 LaserLine.endColor = GetComponent<EnemyType>().color;
 LaserLine.material.SetColor("_Color", GetComponent<EnemyType>().color);
What Am I doing wrong ?
 
                 
                screenshot-1.png 
                (142.9 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
Changing two different objects renderer colour 1 Answer
Creating a line between different colors? 0 Answers
Find HDRP Lit Shader 1 Answer
How to apply two colors to the object? 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                