Hello! I am making a 2D game and my background needs to be animated. I want to swap the textures of a plane in accordance to an object's position. I tried several approaches, and I think this is the closest:
var BG01 : Texture;
var g_Background = gameObject.Find("g_Background");
if((gameObject.transform.position.x) >= 1)
renderer.material.SetTexture("g_Background", BG01);
but I get this error: "Material doesn't have a texture property "g_Background" "
So how would I do that? or is there another way to do this?
Thanks a bunch!