I have been looking for a thread that would help with texture offset on an object, but I have come across something that is not in the current API. public class ScrollScript : MonoBehaviour { public float speed = 0; void Update () { renderer.material.mainTextureOffset = new Vector2 (Time.time*speed,0f); } } I have attempted to change this to public class ScrollScript : MonoBehaviour { public float speed = 0; static Renderer rend = GetComponent <Renderer>(); // Use this for initialization void Start () { } // Update is called once per frame void Update () { rend.material.mainTextureOffset = new Vector2 (Time.time*speed,0f); } } But I am getting An object reference is required for a non-static field, method, or property 'UnityEngine.Component.GetComponent<T>()' error. New to scripting so I feel like I am missing something simple!
Code (CSharp): public class ScrollScript : MonoBehaviour { Renderer rend; // Use this for initialization void Start () { rend = GetComponent <Renderer>(); } }