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’