Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development Materials in Unity Scripting Materials Animating Material Offsets

ERROR CS0264 : THE TYPE OR NAMESPACE NAME 'MATERIALS' COULD NOT BE FOUND.ARE YOU MISSING AN ASSEMBY REFERENCE

It throws this error when I tried to play My Script(AnimatedMaterials.cs):

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class AnimatedMaterials : MonoBehaviour {

private Renderer rend;
private Materials mat;
[SerializedField]
private float offsetSpeed = 0.02f;
// Use this for initialization
void Start () {

    // Get the renderer and material

    rend = GetComponent<Renderer> ();
    mat = rend.material; 



}

// Update is called once per frame
void Update () { 

    float offset = Time.time * offsetSpeed; mat.SetTextureOffset ("_MainTex", new Vector2(0, offset)); 
}

}