- Home /
Question by
Multicody11 · Nov 24, 2012 at 02:45 PM ·
error
NullReferenceException: Object reference not set to an instance of an object
Ok so i made a script it goes
function OnMouseEnter(){
Renderer.Material.Color=Color.red;
}
function OnMouseExit(){
Renderer.Material.Color=Color.white;
}
, And i get an Error Saying
`NullReferenceException: Object reference not set to an instance of an object`
I'm not sure why i get this. If you could help please do so. Thanks!
Comment
Answer by DannyB · Nov 24, 2012 at 06:15 PM
Try lowercase: renderer.material.color = Color.white
Otherwise you are referring to the class and not the object and fields.
Your answer