I recently downloaded the procedural unity example project and came across something that I can’t figure out. In one of their script theirs these lines:
private var perlin : Perlin;
private var fractal : FractalNoise;
I made them public but nothing showed up in the inspector. If you can’t assign something to it then whats the point of having it? What do these lines mean because I though you could only make variables ints, floats, booleans, ect… Then I put these lines of code in a new script and I got the error: The name ‘Perlin’ does not denote a valid type (‘not found’). Did you mean ‘TreeEditor.Perlin’? and The name ‘FractalNoise’ does not denote a valid type (‘not found’). Did you mean ‘TreeEditor.FractalNoise’?
Here is the whole script from the example project in case you need more info.
// This script is placed in public domain. The author takes no responsibility for any possible harm.
var gray = true;
var width = 128;
var height = 128;
var lacunarity = 6.18;
var h = 0.69;
var octaves = 8.379;
var offset = 0.75;
var scale = 0.09;
var offsetPos = 0.0;
private var texture : Texture2D;
private var perlin : Perlin;
private var fractal : FractalNoise;
function Start ()
{
texture = new Texture2D(width, height, TextureFormat.RGB24, false);
renderer.material.mainTexture = texture;
}
function Update()
{
Calculate();
}
function Calculate()
{
if (perlin == null)
perlin = new Perlin();
fractal = new FractalNoise(h, lacunarity, octaves, perlin);
for (var y = 0;y<height;y++)
{
for (var x = 0;x<width;x++)
{
if (gray)
{
var value = fractal.HybridMultifractal(x*scale + Time.time, y * scale + Time.time, offset);
texture.SetPixel(x, y, Color (value, value, value, value));
}
else
{
offsetPos = Time.time;
var valuex = fractal.HybridMultifractal(x*scale + offsetPos * 0.6, y*scale + offsetPos * 0.6, offset);
var valuey = fractal.HybridMultifractal(x*scale + 161.7 + offsetPos * 0.2, y*scale + 161.7 + offsetPos * 0.3, offset);
var valuez = fractal.HybridMultifractal(x*scale + 591.1 + offsetPos, y*scale + 591.1 + offsetPos * 0.1, offset);
texture.SetPixel(x, y, Color (valuex, valuey, valuez, 1));
}
}
}
texture.Apply();
}
Also that script contains the line:
var valuex = fractal.HybridMultifractal(...);
If you search for this function you get nothing. This really stumps me because you can’t just make up functions! It cant be a .Net method because nothing is being imported.
Please help me under stand why there are made up functions and variables of type “Perlin” and “FractalNoise”.