You need to stretch the image on the GameObject using the script - well, how easy it would be if you drag this image onto the GameObject. But the script. Game Objects in our array are easy to access. For example, so I put the color on the GameObject, which is in the piece array

pieces[1].GetComponent<pieceController>().setColor(Red); public void setColor(Color newColor) { myColor = newColor; this.GetComponent<Renderer>().material.color = myColor; 

Here's how I put not a color but a picture of some sort of Assets?

    1 answer 1

    Everything turned out to be quite simple

     public Material mymaterial; pieces[1].GetComponent<pieceController>().setColor(Red); public void setColor(Color newColor) { myColor = newColor; this.GetComponent<Renderer>().material = mymaterial; this.GetComponent<Renderer>().material.color = myColor;