Textures are offset 1 pixel to opposite side of plane

So I have a cube made of a plane for each side. When I put a texture on the planes, the texture is offset so that the end of the texture appears on the other side. Using renderer.material.mainTextureOffset and similar functions didn’t work in moving the texture around. How can I fix it?

You can see how the middle borders have colors from the other sides in this picture…

what are the settings of your texture in Inspector? it looks like you have the setting “Wrap Mode” set to “Repeat”
it should be “clamp”

When I do this, the texture doesn’t appear. (White was the previous texture it had on). It’s not set in the editor but in script though as I am creating the texture with a script.

Edit: By using both clamp and a small texture offset of 0.1f it turned out correctly.