How can this be fixed

I get the following error in MouseLook.cs. I’m new to C# so this is puzzling me

Error CS0120 An object reference is required for the non-static field, method, or property ‘Renderer.materials’ AncientTimes.CSharp

This is the current code.

if ( GetComponent()
){
GetComponent();
Renderer.materials[materialIndex].SetTextureOffset(textureName, uvOffset);
}
}
}

Your first GetComponent has no Generic Parameter (GetComponent()). Your if statement must evaluate to either true or false.

You’re trying to access Renderer.materials instead of renderer.materials. The class Renderer does not have a static field or property called materials, only instances of the class do. If this script is a MonoBehaviour, just change the case. If not, then access the scriptVar.renderer.materials property, where scriptVar is a reference to a MonoBehaviour.

var renderer = GetComponent();
if (renderer)
renderer.materials[materialIndex].SetTextureOffset(textureName, uvOffset);