- Home /
Question by
ChrisBriscoe · Jan 26, 2012 at 09:26 PM ·
editor-scripting
trying to modify Eric Haines TerrainObjExporter so that it writes a subset of the terrain
And I have two questions: How can I debug/printout variables for this code and what's wrong with the terrain.GetHeights call in the following code snipppet
function Export () {
var fileName = EditorUtility.SaveFilePanel("Export .obj file", "", "Terrain", "obj");
var w = terrain.heightmapWidth;
var h = terrain.heightmapHeight;
var meshScale = terrain.size;
var tRes = Mathf.Pow(2, parseInt(saveResolution));//1,2,4,8,16 ??
print("w= "+w);
print("h= "+h);`enter code here`
print("tRes= "+tRes);
meshScale = Vector3(meshScale.x/(w-1)*tRes, meshScale.y, meshScale.z/(h-1)*tRes);
var uvScale = Vector2(1.0/(w-1), 1.0/(h-1));
//var tData = terrain.GetHeights(0, 0, w, h);
//w == h ??
var tData = terrain.GetHeights((w/2)-20, (w/2)-20, (w/2)+150, (w/2)+150);
The print statement is not executed, or doesn't work in this context, and the error is thrown before any output.
Help much appreciated. Chris
Comment
Use Debug.Log ins$$anonymous$$d of print, which only works in $$anonymous$$onoBehaviour classes.
Your answer
Follow this Question
Related Questions
How do I get an array of names of all the sprites in a project, with an editor script? 2 Answers
Unity API for checking if an object was modified 3 Answers
How to minimize the main editor Window by script 1 Answer
Why would editor script be slow on first compilation? 0 Answers
Help with scrollbar and offset 1 Answer