Scrolling background with changing textures

Posted by Simran kaur on Game Development See other posts from Game Development or by Simran kaur
Published on 2014-08-23T00:56:07Z Indexed on 2014/08/23 4:28 UTC
Read the original article Hit count: 207

Filed under:

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?

© Game Development or respective owner

Related posts about unity