First, sorry for my english.
Hi Guys, i’m starting now on Unity and Coding.
I will make a Scroll Background.
And i’m with this code in C#, but i like more to code in JS.
I had tried to convert, but don’t work…
What changes i’ve to make to this code work properly?
Thanks!
using UnityEngine;
using System.Collections;
public class moveOffset : MonoBehaviour {
private Material currentMaterial;
public float speed;
private float offset;
// Use this for initialization
void Start () {
currentMaterial = renderer.material;
}
// Update is called once per frame
void Update () {
offset += 0.001f;
currentMaterial.SetTextureOffset ("_MainTex", new Vector2 (offset*speed,0));
}
}