In this code, I keep getting the error in the title, and I don’t know why, given the left hand side isn’t of the type Object. Here is the code:
#pragma strict
var height = 10;
var noiseSize = 15.0;
function perlinNoise(x,y){
var noise = Mathf.PerlinNoise( x / noiseSize, y / noiseSize );//error here
return noise*height;
}
Anytime you see the words ‘cannot’ and ‘Object’ in a Javascript compiler error, it is almost surly an issue of a variable declaration needing a type. Try this:
#pragma strict
var height = 10.0;
var noiseSize = 15.0;
function perlinNoise(x : float, y : float){
var noise = Mathf.PerlinNoise( x / noiseSize, y / noiseSize );//error here
return noise*height;
}