using UnityEngine;
public class Button_Cube_TextureScroll : MonoBehaviour, IButtonTriggerable
{
public Renderer cubeRenderer;
private bool isScrolling;
Vector2 offset;
public void Triggered()
{
Debug.Log("Cube Triggered");
isScrolling = !isScrolling;
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
if (isScrolling)
{
offset += new Vector2(0.1f,0.1f) * Time.deltaTime;
cubeRenderer.material.SetTextureOffset("_MainTex", offset);
}
}
}
i made this code to experimenting with accessing different atributes and testing my interactability interface, and while the Debug Log is going through the texture modification is not. What am i doing wrong? i dragged the gameObject with the relevant material to the Renderer.