hi, i am making a simple editor script that will take a heightmap and turn it in to a cubic terrain, but when trying to use the editor window i get this error:
VerificationException: Error verifying CubeLand:OnGUI (): Compare instruction applyed to ill formed stack (Complex x Int32) at 0x0040
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
this is the script:
#pragma strict
class CubeLand extends EditorWindow{
var texture:Texture2D;
var obj:GameObject;
var sizeX:int = 100;
var sizeZ:int = 100;
var maxHeight:int;
@MenuItem ("Window/CubeLand")
static function ShowWindow(){
EditorWindow.GetWindow (CubeLand);
}
function OnGUI () {
texture = EditorGUI.ObjectField(Rect(3, 3, Screen.width, 100), "HeightMap", texture, Texture2D, true) as Texture2D;
if(texture == !null){
sizeX = EditorGUI.IntSlider(Rect(3, 106, Screen.width, 15), "X Size", sizeX, 100, texture.width);
sizeZ = EditorGUI.IntSlider(Rect(3, 124, Screen.width, 15), "Z Size", sizeZ, 100, texture.height);
}
if(GUI.Button(Rect(0, Screen.height - Screen.height/10, Screen.width, Screen.height/10), "Generate")){
if(texture == null){
EditorUtility.DisplayDialog("You forgot somthing!", "You forgot to enter a texture, to proceed you must enter a texture that has a heighter reseolution of 100x100", "OK, I'll add a texture", "Cancel");
}else if(texture.width <= 100 || texture.height <= 100){
EditorUtility.DisplayDialog("You forgot somthing!", "You enterd a texture under the minumom resolution (100x100, please emter a new texture)", "OK, Ill, enter a differant texture", "Cancel");
}
}
}
}