- Home /
Infintely scrolling texture ends?(only scrolls through once)
Hi, I am currently making a simple 2d game. I wanted to have an endlessly scrolling background(scrolling vertically) so i used a script to make it scroll with the texture offset. Here is my current script:
#pragma strict
private var offsetY : float;
function Update ()
{
if (renderer.material.mainTextureOffset.y<0.8){
renderer.material.mainTextureOffset = Vector2(0,offsetY);
offsetY += 0.1 * Time.deltaTime;
}
}
And the plane that it is attached to is a child of the main camera. It scrolls once, but then it ends. Here is a screenshot:
The texture just becomes plain black. Any ideas. (Also my graphics aren't this bad, i'm just starting mechanics).
Answer by robertbu · Feb 14, 2014 at 05:01 AM
Select the texture you are using for the material. Then in the Inspector, change Wrap Mode from 'Clamp' to 'Wrap'.
Your answer
Follow this Question
Related Questions
Scrolling Texture scrolls both maps. Only want single map to scroll? 0 Answers
Initialize UV offset with UV scrolling script 1 Answer
Offset of texture with Raycast 1 Answer
Scroll GUI Texture 2 Answers