The great God and the small God everyone good, starting from today I will start to send their own blog, share some knowledge, if you are the program industry big guy Words hope you can point out, if you are the program small white words also hope you can ask some questions, let me continue to move, in the sea in the sky to sail farther, thank you.
Not much to say here, let's take a look at this today, in unity, the terrain partitioning method.
I prefer to use plugins to split the code, which is the terrain slicing plugin.
First, let's start by importing the downloaded terrain slicing plugin into unity, and then we'll find that the Terrain menu option appears in the menu bar above the screen, open it, we choose the slice terrain option to do the terrain slicing, If you have only one map in the current scene, then the system will automatically help you choose the default terrain, if there are two or more terrain, you need to manually select, and then follow the figure below, you can get the desired effect.
At this time, the map in your window will be programmed with a large map and n small map, we will remove the components in the large map, make it an empty object, and then put the small map in the large map empty objects, so that our map is divided to complete
So our map has become a small piece of it.
This time, if you are to do the dynamic loading of maps, then we just put the plug-in setneighbors This code on the small map, it is convenient to get this small map of the name of several maps, so that the simple code to achieve the dynamic loading of the map we need
Well, today's terrain cutting has been achieved, this is a very simple and practical plug-in, the principle is not complex, we can also go to see the plugin documentation, in the plugin instructions folder inside, with more detailed instructions, I will translate it into Chinese below and you can look at it below.
Slice procedure
1) Start the slicing process, select the terrain option at the top of the Unity Editor, and click the slice terrain option. A window will appear with some configuration information.
2) Drag the terrain you want to split into the terrain slice field. Or, if you selected the terrain when you clicked the Slice terrain option in step 1, the terrain already appears in that field.
3) Enter a detailed resolution for each patch. Preferably, the value should match the basic topographic detail resolution of each patch value. This information cannot be accessed through a script, which is why you must enter it here. You can enter values that differ from the base terrain setting, but this will result in less accurate replication of the detail grid (plant and grassland).
4) Select the slice dimension that you want to end. 2x2 simply means that the basic terrain will be split along the x-axis 2 and z-axes 2 times to create 4 topographic slices. 64x64 is not tested and is not recommended for use, so please take your own risks.
5) Sets the file path where you want to store the terrain data. By default, this is the asset/terrainslicing/terrain data. If you want to temporarily create terrain data in another folder, simply enter the new path here. If you want to permanently change the default folder, enter the new file path and select the Save current file path as default file path button. Make sure that there is no "/" after the folder name on the file path (for example, after terrain data for the default path of the file), otherwise an error will occur.
6) When you click the Create Terrain button, select whether to overwrite the existing terrain data. This is a security feature to make sure you accidentally overwrite the terrain data that you have created. If you try to override the data when this value is not selected, a warning message appears telling you to check for this value, and the slice operation will not start.
7) Click the Create Terrain button to wait for the progress bar to fill. If the progress bar is not displayed, a notification message for the notification error is displayed in the editor window. Sometimes you may need to check the console for more detailed information. Finally, make sure that the slice terrain script is only executed in edit mode.