Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Weird Render Artifact

Discussion in '2D' started by TLHPoE, Apr 10, 2016.

  1. TLHPoE

    TLHPoE

    Joined:
    Apr 9, 2016
    Posts:
    3
    Hello, I'm not using the beta as I am paranoid of unstable builds, but needed a repeating tile/sprite so I used a tweaked version of a script from a guide to produce the effect. However, at certain zooms and at random, there will be a green line, which I'm assuming is the grass tile repeating again downwards on a minuscule level, between the grass layer and the dirt layer, in the scene view and/or the game view.

    Here's a picture of it:


    Here's the script:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class RepeatingTile : MonoBehaviour {
    6.     public int textureSize = 16;
    7.  
    8.     void Start() {
    9.         var newWidth = transform.localScale.x / textureSize;
    10.         var newHeight = transform.localScale.y / textureSize;
    11.  
    12.         transform.localScale = new Vector3(newWidth * textureSize, newHeight * textureSize, 1);
    13.  
    14.         GetComponent<Renderer>().material.mainTextureScale = new Vector3(newWidth, newHeight, 1);
    15.     }
    16. }
    17.  
     
  2. shawnrevels

    shawnrevels

    Joined:
    Aug 13, 2014
    Posts:
    86
    Try using your character and walk. if it still does it change your scale to an even number.. like dont use 1.2 use 1 or 2..
     
  3. shawnrevels

    shawnrevels

    Joined:
    Aug 13, 2014
    Posts:
    86
    And why do you need a repeating tile effect? why dont you use your tile and snap them to position?
     
    theANMATOR2b likes this.