- Home /
How do I instantiate the TerrainToolKit script?
I'm working on trying to create randomized terrains during runtime. I've used terrain toolkit before on unity 3, however, I was just messing around with the actual editor portion and did not delve into scripting. Now, I would like to call different terrain toolkit procedures onto my terrain but, when using the code off of their site (http://www.sixtimesnothing.com/perlin-generator/) i get that the PerlinGenerator function is not part of the UnityEngine.GameObject class. I believe i'm just missing something completely obvious. All I'm looking for is something like this:
function OnGUI ()
{
if (GUI.Button(new Rect(0,0,100,100), "Generate!"))
{
var go : GameObject = GameObject.Find("Terrain");
go.GetComponent("TerrainToolkit").PerlinGenerator( 4, 1.0, 8, 0.8 ); // This is straight off of their website...
}
}
Answer by Cowboykilla · Jun 01, 2013 at 10:49 PM
FYI, for anyone who doesn't know, when trying to use GetComponent, do not place quotations around the script you are trying to access...
"go.GetComponent(TerrainToolKit).PerlinGenerator(4, 1.0, 8, 0.8);"
Your answer
Follow this Question
Related Questions
Instantiating too much at Start? Terrain Objects. 0 Answers
Random terrain generation at runtime 2 Answers
making prefabs at runtime? 2 Answers
Paint Terrain Texture From Vector3 List 0 Answers
Procedurally generating terrain? 0 Answers