Object Refrence Not Set To An Instance Of An Object?

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);
	}
}

I think that above error indicates that getter doesn’t work: what is Generate in your code ? Do you have it as public GameObject defined somewhere else ? Or it’s mistake, because your method has name “Generate”.

How i solved this?
nullrefrenceExcepton = Object refrence not set to instance object

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CrossHair : MonoBehaviour {

[SerializeField] Texture2D crossHairImg;
[SerializeField] int size;
[SerializeField] float maxAngle;
[SerializeField] float minAngle;

float lookHeight;

public void LookHeight(float value)
{
    lookHeight += value;

    if (lookHeight > maxAngle || lookHeight < minAngle)
        lookHeight -= value;
}

private void OnGUI()
{
    Vector3 screenPosition = Camera.main.WorldToScreenPoint(transform.position);
    screenPosition.y = Screen.height - screenPosition.y;
    GUI.DrawTexture(new Rect(screenPosition.x, screenPosition.y - lookHeight, size, size), crossHairImg);
}

}