Question by
Dis-guy · Aug 09, 2016 at 06:56 PM ·
errorscript error
UCE0001 error
I have typed this script, and the editor keeps saying I need to add a ";", but I have. The strange this is. the error says it's in the middle of the line, after "material", not at the end were the semicolon should be.
if (level == 2){
Shooter.GetComponent.<Renderer>()material = Orange;
}
if (level == 3){
Shooter.GetComponent.<Renderer>()material = Red;
}
Comment
Answer by Landern · Aug 09, 2016 at 06:58 PM
material is a member of the Renderer class. You need to specify by using a "." dot/period what member you're setting/getting.
The above should be:
if (level == 2){
Shooter.GetComponent.<Renderer>().material = Orange; // added a period/dot before material
}
if (level == 3){
Shooter.GetComponent.<Renderer>().material = Red; // added a period/dot before material
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612090502im_/https://answers.unity.com/themes/thub/images/avi.jpg)