- Home /
Problem with Scrolling Background in more recent version of Unity..
I'm making a game in which I very need to put my background to scroll, in earlier versions of Unity it was done very easily, by putting the specific background in import settings being Texture, also set to 'Repeat' adn this worked! But in the newer versions of Unity there is no more 'Texture', some say Instead of 'Texture' is now 'Default', but I tried it and it still does not work..if i dont find out how to make a scrolling background in the current version(5.6) which i use, I will should to download the older version in which the same thing is much easier to make..
Answer by adipatil3517 · Aug 22, 2017 at 05:34 AM
plz attach your code for better understanding
There is no code here, here is a link that in earlier versions this could have been done: https://www.youtube.com/watch?v=HrDxn$$anonymous$$I7pCc But as there are now no more options like in the video, I must find a special way to do this, because I'm using the new version of Unity.
it is the same as previous and keep it to default and repeat mode and apply texture on quad or plan and through coding change the offset. @$$anonymous$$egii
Answer by naryk86 · Aug 23, 2017 at 07:34 PM
Could you explain better, please? I wrote this script, to move horizontally 2 sprites (because I think that in unity2017 I can use sprite without Quad). (tileSizeZ is the size of one of the sprites.)
public float scrollSpeed; float tileSizeZ;
private Vector3 startPosition;
// Use this for initialization
void Start()
{
startPosition = transform.position;
tileSizeZ = transform.GetComponent<Renderer>().bounds.size.x;
}
// Update is called once per frame
void Update()
{
float newPosition = Mathf.Repeat(Time.time * scrollSpeed, tileSizeZ);
transform.position = startPosition + Vector3.right * newPosition;
}
But I obtain that the 2 sprites return to the original position.
Thanks
I fix the problem, just follow this video exactly, only difference is to set you background to be default ins$$anonymous$$d of texture(in import settings).. https://www.youtube.com/watch?v=HrDxn$$anonymous$$I7pCc