Im Trying To make a minecraft type Terrain Generation Script and it gave me this error :
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetProperty (System.Object target, System.String name)
UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
Chunk.Generate () (at Assets/Script/Chunk.js:20)
Chunk.Start () (at Assets/Script/Chunk.js:7)
heres my script:
var cubes : GameObject;
var spawnInterval = 3.0;
var heightScale = 5.0;
function Start()
{
Generate();
}
public function PerlinNoise(x : float, y : float) : float
{
var noise : float = Mathf.PerlinNoise( x / heightScale, y / heightScale);
return noise * heightScale;;
}
function Generate()
{
for (var y = -4; y < 5; ++y)
for (var x = -4; x < 5; ++x)
{
var Cube : GameObject = Instantiate(cubes);
Cube.transform.position = Generate.transform.position + Vector3(x,PerlinNoise(x,y),y);
}
}