Set Substance RandomSeed variable in procedural material in c#?

I am trying out the evaluation version of Substance Designer which is BRILLIANT, however one thing I am finding odd is that I have a prefab and anywhere from 0-5 instances of it within the scene, however I want each one to look slightly different, so I was planning to just tweak the exposed random seed for each instance however nothing seems to happen.

I am currently using:

var instanceMaterial = instanceGameObject.renderer.material as ProceduralMaterial;
instanceMaterial.SetProceduralFloat("RandomSeed", Random.Range(0,30));
instanceMaterial.RebuildTextures();

instanceGameObject is within a loop so will be an instance of each game object of that prefab. Anyway they all look the same as if either ALL of them have changed or none of them have. Am I doing something wrong?

After debugging all the possible values at runtime using GetProceduralPropertyDescriptions() I found that the random name I wanted was $randomseed

This works!

Random.Range(0,30) will return the same value in the same frame/tick. So you can put this in a coroutine and lag a bit by waiting for ms… or end of frame.

OR better

Set the seed at each iteration

UnityEngine.Random.seed = i++; // or some incremental value

http://docs.unity3d.com/Documentation/ScriptReference/Random-seed.html

var instanceMaterial = instanceGameObject.renderer.material as ProceduralMaterial;
instanceMaterial.SetProceduralFloat("RandomSeed", Random.Range(0,30));
UnityEngine.Random.seed = i++;
instanceMaterial.RebuildTextures();

I dont think that the random element is really the issue, as before now I have set the random seed to just be i and it still doesn’t work. I think the problem is down to how im setting the procedural value. I also have a color component which when set seems to remove all color, so this question is more around the correct way to interact with setting the procedural values.

(Although it is interesting to know the limitations on range, I am seeding it using the itteration count, still have the issue)

I wonder if the problem with your script is as follows:
If you create a prefab, which is using a substance material, instancing the prefab won´t instance the substance material. So if you change the $randomseed, it will affect all instances of your prefab.

In other words: Maybe you have to duplicate the substances within the project window, then apply them.

(I am new to scripting, so sorry, if this is pure nonsense! :))