Combining Terrain and Sample 4, scale issue


I’ve combined the terrain map and sample 4 scripts, and I seem to be running into an issue of scale. When generating units, they are placed well below (y) the terrain and nodes. Additionally, the units appear to group in a small cluster in the center (x, z) of the grid, not full nodes apart. If I click on them in the game view (by removing the terrain in the hierarchy), it returns the error:

UnityException: Transform child out of bounds
Unit.UnitSelected () (at Assets/Plugins/MapNav2/Sample4Unit.cs:56)

Clicking on the unit again after that will return

UnityException: Transform child out of bounds
Unit.UnitDeselected () (at Assets/Plugins/MapNav2/Sample4Unit.cs:64)

Any idea what’s causing this?

(Leslie Young) #2

Not sure. Best would be to use example to learn and then start with your own clean scene and a new MapNav object in it with your own scripts. Some sample scripts might be very specific to the sample scenes and break when used outside of the sample environment.

Sample 4 for example makes use of placed tiles and not a terrain. So its generator will not work correctly. In that case you need to look at sample 3’s node/ grid generator works.