Hi everyone,
I need to import a shapefile into my unity scene. Could you please tell me if there is a way to do it?
Thank you
Here is the method we used :
- First : a C# script was written by ESRI, which is the society which created the Shapefile format. This script basically reads polylines, lines… but if you want to use it for 3D (polygon Z, type 35), you need to modify this script to add the Z axis (which we’ve done).
- Then : In a monobehavior script (that you’ll create and bind to GameObject) you will call the method of ESRI’s script. This new script will allow you to catch 3DVectors.
- Then : You call Mesh’s method by using a library called Triangle.Net which will make the mesh. BUT, this last library have to be sligthly modified if you want to use it with shapefile value (which we’ve done too, by removing a directory).
Here is our work (most of it from my colleague in fact, credits to her ) :
I’m giving you the link to a GitHub where the files are in the states in which we’ve been able to have something drawn into Unity. My collegue is still working on it and we’ll probably push the work for you to have it (with real 3D shapefiles, PNG, greyscale heightmap correctly drawn into Unity).
Technically, it works if you use the shapefile given on the GitHub and if you correctly bind the script and the ChunkPrefab to an empty GambeObject AND if you don’t forget to put the path of the shapefile into the correct field (click on the GameObject with the binded script, and you’ll have a field named “path” waiting for you to fill it).
Link to ESRI script :
Link to Triangle.Net :
Really hope it can help you, sorry for the mess, we’ll try to make things clear once it’s all done
Hi @asalaporte ; No I still looking for a solution. Do you have a solution since your last message?
Can you add readme file to your github repository?
We don’t know how to use it.
I am referring to this project:
[ShapeFileForUnity/Assets at master · CharlotteAndre/ShapeFileForUnity · GitHub][1]
Hi ! I’m the programmer of this code ! I’ve done a readMe of this project but forget to add it on my Git ! I’ll try to find it and insert it as soon as possible !