NullReferenceException enemyAI.Update () (at Assets/enemyAI.js:14) ,NullReferenceException enemyAI.Update () (at Assets/enemyAI.js:14)

im creating a game and when i wrote the scriot for my enemy AI this error keeps poping up and im not sure whats wrong with it.

Also this error pops up too: Assets/enemyAI.js(14,30): BCE0020: An instance of type ‘UnityEngine.Renderer’ is required to access non static member ‘material’.

anyone know why?
,im creatiing a enemy AI scriot and this error keep poping p does anyone know why? i cant figure it out

Based on the script you posted. Looks like the way you’re accessing the renderer is incorrect.

Renderer.material.color =;

using a capital R here causes it to refer to the type, not the instance of the component on the object. try this instead.

renderer.material.color =;