0
\$\begingroup\$

I wrote the script for automatic repetition of texture background. To save it I typed Cmd+S. I dragged and dropped the script to Background in Hierarchy. When hit play button the texture doesn't scale and doesn't repeat itself. What is it that I am doing wrong?

using System.Collections;

public class TiledBackground : MonoBehaviour {

    public int textureSize = 32; 

    void start(){
        var newWidth = Mathf.Ceil (Screen.width / (textureSize * PixelPerfectCamera.scale)); 
        var newHeight = Mathf.Ceil (Screen.height / (textureSize * PixelPerfectCamera.scale)); 

        transform.localScale = new Vector3(newWidth * textureSize, newHeight * textureSize, 1);

        GetComponent<Renderer>().material.mainTextureScale = new Vector3(newWidth, newHeight, 1); 
    }
}    

Expected Results:

Results that I'm getting are same as before. Script doesn't seem to work:

\$\endgroup\$
3
\$\begingroup\$

Your start method is named wrong. The 's' should be capitalized.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .