Prefab deleted my terrain.

I have just spent several hours, up to four in the morning creating quite a complex terrain. When I was happy with it. I created a new prefab and dragged the terrain to it. Both the prefab and the terrain name turned blue as you would expect.

However I went to a separate scene and dragged in the new prefab but the terrain wasn’t there. In the inspector it said terrain asset missing. Huh?

I went back to my original scene to discover the terrain wasn’t there either. I’ve looked everywhere in my assets folder and haven’t been able to find it. The annoying thing is I saved the project right after making the prefab.

Has anyone else had this problem?

Al

I think I’ve found the problem.

I created the terrain using the script obj2terrain. It seems the terrain created using this script doesn’t get saved as a terrain.asset. Does anyone know how to fix this?

Regards
Al

I believe AssetDatabase.CreateAsset(Object asset, string path) is what you need. Pass your terrainData object as the ‘asset’ parameter.

Use the Obj2Terrain script to create the terrain. Next export the new terrain as a raw file. Delete the terrain created
with the Obj2Terrain script and create a New terrain the standard way using the RAW file you exported earlier. Using this method will allow you to use the grass/tree/detail mesh painting features.

This is what I did in the end.

I did want to edit the RAW file and crop out the extra area’s that Obj2Terrain adds in but unfortunately Photoshop doesn’t like 16bit RAW files. Does anyone know of a good free editor for RAW files?

Thanks
Al

Are you saying that line of code needs to go into the Obj2Terrain script?

Thanks
Al