How to make an object with dynamically-spaced tiled texture?

I have a plane with a 256x256 texture (a red circle) that needs to be repeated at a certain interval.

What I want is a script that allows me to set a var on the plane (ie. Even/Increasing/Decreasing) so that the red circles appear on the plane at even, increasing or decreasing intervals.

It might also be necessary to scale the texture on each plane, so that it lines up correctly with other game elements.

Could anyone help with a code-snippet/worked example?

Start by looking at renderer.material.SetTextureScale. With that you can scale up/down the UVs, which (assuming you don't have the wrap mode to clamping on your material) will increase/decrease the number of tiles.

try this script i made :

var divFacter : int = 2;
var customName : boolean = false;
var propName1 : String;
var propName2 : String;

function Update () {
    if(customName == false){
        renderer.material.mainTextureScale.x = transform.localScale.x/divFacter;
        renderer.material.mainTextureScale.y = transform.localScale.z/divFacter;
    }
    else{
        var scale : Vector2= Vector2( transform.localScale.x/divFacter, transform.localScale.z/divFacter );
        renderer.material.SetTextureScale(propName1,scale);
        renderer.material.SetTextureScale(propName2,scale);
    }
}

propName1-2 only works if customName is checked true.

only check customName true if you are using a custom shader that uses a custom property type like : "_ParticleTexture".

but if you are using diffuse it should work fine.

hope this helps :)