public class Scroll : MonoBehaviour {
public float speed = 0.5f;
void Update()
{
Vector2 offset = new Vector2(0, Time.time * speed);
renderer.material.mainTextureOffset = offset;
}
i didn't understand where the problem is, but it is supposed to be in the renderer.material part.
I have put this code in a Quad to try and make it my background.
edit: error messages :
- Assets/Scroll.cs(12,8): error CS0619: UnityEngine.Component.renderer' is obsolete:
Property renderer has been deprecated. Use GetComponent() instead. (UnityUpgradable)'
- Assets/Scroll.cs(12,17): error CS1061: Type UnityEngine.Component' does not contain a definition for
material' and no extension method material' of type
UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?)
- nable to parse file Assets/Game scene.unity.meta: [Control characters are not allowed] at line 0