Need help with a Script for a 2D Game!

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class SpriteControll : MonoBehaviour {
public List animationStayRight;
public float speed = 1;
// Use this for initialization
void Start () {
}

// Update is called once per frame
void Update () {
SetTexture (animationStayRight);
}
void SetTexture(List animationSprite)
{
int index = (int)(Time.time * speed);
index = index % animationSprite.Count;
renderer.material.mainTexture = animationSprite[index]; <<<<<< Here i got an Error
}
}

Error:
Assets/Scripts/SpriteControll.cs(19,26): error CS0120: An object reference is required to access non-static member `UnityEngine.Renderer.material’

i have the same problem :(, no answer.

Can you post your code using code tags & the error you are getting. The error will show the lines causing problems & the formatted code will let us identify the line #'s.

In unity5 you need to use GetComponent, they no longer store references for you.

This mean the line:

renderer.material.mainTexture =animationSprite[index];

Becomes:

GetComponent<Renderer>().material.mainTexture =animationSprite[index];

Hope that makes sense. You can google unity 5 changes too get better examples & explanations if needed.