Scrolling background with changing textures
- by Simran kaur
I have the 2 cubic structures that are my tracks and are scrolling basically to give effect of movement on object. In my OnBecameInvisible() method, I have changed their Tiling using mainTextureScale
void OnBecameInvisible()
{
renderer.material.mainTextureScale = new Vector2(1, numberOfLanes);
this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, 20.0f);
}
The tiling works fine. But the alternative tracks have their Tiling set to 0 which is giving an undesirable effect.
Requirement:
I want to be able to set the Tiling of every track that is visible on the screen. How do I do it?