Strange Terrain Issue

I’ve been having a very odd problem with the terrain in my game (using Unity’s Terrain Engine). In the editor, everything seems fine, but when the game is run, the terrain does not appear to be rendered where it actually is. And by that, I mean that the terrain’s collider is not lined up with the terrain itself, and detail meshes and trees still appear to be rooted where they actually are on the terrain’s collider. Here’s a couple screenshots showing what I mean.

In-game
Imgur

In the editor
Imgur

This happens throughout my world, and I really can’t seem to figure out what the problem is. I’ve tried deleting the Terrain and adding a new one (with the same Terrain Data) but the problem persists.

Any ideas?

If your terrin is not show when you run the build it may be the issue of isTrigger is checked in the terrain collider you are using a character controller in the game. so please uncheck the isTrigger if you checked.

it’s unchecked. Also, that doesn’t really seem to be related to my problem. The terrain’s collider seems to work fine, but the rendering of the terrain seems to be messed up in some sense. The player collides with it just fine, but the collisions don’t always line up with where the terrain is rendered (nor does the grass).

I’m going to guess and say: try lowering the Pixel error slider:

http://docs.unity3d.com/Documentation/Components/terrain-OtherSettings.html

Thanks for the suggestion, Alf. The pixel error was already set to 5, and moving it has no effect on the problem.

Here’s a couple pictures that perhaps give a better idea as to the problem. The first is when the game is not being played, and the second is the same view while playing. When I push the play button the terrain seems to “morph” into a weird, incorrect shape (all over the world).

Scene view, Not playing:

Scene view, started playing:

Hmm… To my eye the heighmap resolution seems to become lower when you hit play. There could be something affecting the geometry in-game and it really seems to be using less triangles in play mode. I would guess again that it has something to do with terrain LOD although I’m not a terrain expert so I can’t be of much more help than that.

http://docs.unity3d.com/Documentation/ScriptReference/Terrain-heightmapMaximumLOD.html

I would suggest to post two new screens both in Wireframe view or Textured Wire. That would help identify the issue more easily.

In your project settings, is your settings for mobile or Pc/mac/linux, or something else ?

This was exactly the problem. Thanks, this has been bothering me for a while!

I had written a “Quality Chooser” that automatically set graphics settings a while back, and apparently I didn’t actually understand what this setting did at the time. Also, that setting isn’t visible in the Inspector (except in Debug mode) so I couldn’t even see that it was set to 1 instead of 0.

Thanks a lot!