Random terrain generation at runtime

I have been trying different ways to get this code for a couple of days now. No matter what I try it's been throwing errors left right and centre, usually about splat-maps being null. The terrain is generated from an instantiated prefab with this script attached. The inspector is set with all of the pieces in place but it still doesn't work. Can someone please tell me where I'm going wrong.

var Tex1Txt : TextAsset;
var Tex2Txt : TextAsset;
var Tex3Txt : TextAsset;
var Tex4Txt : TextAsset;

var Tex1= new Texture2D (1024,1024);
var Tex2= new Texture2D (1024,1024);
var Tex3= new Texture2D (1024,1024);
var Tex4= new Texture2D (1024,1024);
Tex1.LoadImage(Tex1Txt.bytes);
Tex2.LoadImage(Tex2Txt.bytes);
Tex3.LoadImage(Tex3Txt.bytes);
Tex4.LoadImage(Tex4Txt.bytes);

var TerrData : GameObject;
TerrData = GameObject.Find("TrainTerrainPrefab(Clone)");
TerrData.GetComponent("TerrainToolkit").FractalGenerator(0.25, 0.25);

var slopeStops : float[] = [20.0, 50.0];
var heightStops : float[] = [0.2, 0.4, 0.6, 0.8];
var textures : Texture2D[] = [Tex1, Tex2, Tex3, Tex4];

function Awake () 
{   
    TerrData = GameObject.Find("TrainTerrainPrefab(Clone)");
    TerrData.GetComponent("TerrainToolkit").FractalGenerator(0.25, 0.25);
    TerrData.GetComponent("TerrainToolkit").TextureTerrain(slopeStops, heightStops, textures);
}

Just a wild guess: what if you moved the initialization of Tex1-4 into the start of the Awake function? 'textures' too. And you can remvoe dht TerrData inits from the above section, leave it in Awake only

Thank you, a wild guess is still a good help :-)

I managed to get the textures loaded by using Resources.Load and putting them into a resources folder. The API example at the 6x0 website gives me the following error. link text

Error: heightStops contains an incorrect number of values.