Search Unity

problem with offsetting a texture in javascript

Discussion in 'Scripting' started by clearrose, Mar 16, 2015.

  1. clearrose

    clearrose

    Joined:
    Oct 24, 2012
    Posts:
    349
    The code at first worked on normal sized textures at the dimensions of 1024 x 1024. but our background is at an unusual dimensions, 8192 x 512. Now when the offset is suppose to recycle the image, it stretches the last pixels of the image across the screen infinity:

    heres the background:



    and heres what the code is doing when it reaches the end of the background:



    and heres the code:
     

    Attached Files:

  2. clearrose

    clearrose

    Joined:
    Oct 24, 2012
    Posts:
    349
    Need help as soon as possible !
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Make the texture repeat instead of clamped.

    --Eric
     
  4. clearrose

    clearrose

    Joined:
    Oct 24, 2012
    Posts:
    349
    @Eric5h5

    Ok, thanks ! I just quite sure how to do that?
     
    Last edited: Mar 17, 2015
  5. clearrose

    clearrose

    Joined:
    Oct 24, 2012
    Posts:
    349
    Ok, figured out what you were talking about. I changed the setting on the textured from clamped to repeat. Unfortunately that didn't solve the problem, I'm still getting the same results. But there is an added problem, every time unity opens the project. The tiling changes on the y axis, I'm then force to set it ranging from to 0.5 to 1. Depend on unitys mood. Not that offsetting the texture horizontally had to be a problem now vertically as well every time unity opens.