TerrainData 类负责存储高度贴图、细节网格位置、树实例和地形纹理 Alpha 贴图。
Terrain 组件链接到地形数据并渲染它。
| AlphamapTextureName | 地形 Alpha 贴图纹理的名称。 |
| HolesTextureName | 地形孔洞纹理的名称。 |
| alphamapHeight | Height of the alpha map. (Read only.) |
| alphamapLayers | Alpha 贴图的图层数量。 |
| alphamapResolution | The size of the alpha map in texels for either the width or the height. |
| alphamapTextureCount | 返回 Alpha 贴图纹理的数量。 |
| alphamapTextures | 地形使用的 Alpha 贴图纹理。供 Terrain Inspector 用于实现撤销操作。 |
| alphamapWidth | Alpha 贴图的宽度。 |
| baseMapResolution | 用于在地形上渲染远处斑块的底图的分辨率。 |
| bounds | TerrainData 对象的本地包围盒。 |
| detailHeight | The resolution of the detail data stored in TerrainData. |
| detailPatchCount | 沿地形区块边缘的面片数。此属性在经过平方后生成面片网格。 |
| detailPrototypes | Contains the detail texture/meshes that the Terrain has. |
| detailResolution | TerrainData 的细节分辨率。 |
| detailResolutionPerPatch | 每个斑块的细节分辨率。较大的值将减少细节对象使用的批次数。 |
| detailWidth | The resolution of the detail data stored in TerrainData. |
| enableHolesTextureCompression | 启用地形孔洞纹理压缩。 |
| heightmapResolution | The size of the heightmap in texels for either the width or the height. |
| heightmapScale | Returns a Vector3 where the x and z components are the size of each heightmap sample (i.e. the space between two neighboring heightmap samples), and the y component is the entire Terrain's height range in world space. |
| heightmapTexture | 返回高度贴图纹理。 |
| holesResolution | 返回数据和纹理的地形孔洞分辨率。 |
| holesTexture | 返回地形孔洞纹理。 |
| size | 地形的总大小(世界单位)。 |
| terrainLayers | 检索当前地形使用的地形层。 |
| treeInstanceCount | 返回树实例的数量。 |
| treeInstances | 包含当前放置在地形中的树。 |
| treePrototypes | 可在 Inspector 中使用的树原型的列表。 |
| wavingGrassAmount | 地形中摇摆的草的数量。 |
| wavingGrassSpeed | 摇摆草的速度。 |
| wavingGrassStrength | 地形中摇摆的草的强度。 |
| wavingGrassTint | 地形具有的摇摆的草的颜色。 |
| CopyActiveRenderTextureToHeightmap | 将活动 RenderTexture 的指定部分复制到地形高度贴图纹理。 |
| CopyActiveRenderTextureToTexture | 将活动 RenderTexture 的指定部分复制到地形纹理。 |
| DirtyHeightmapRegion | 将高度贴图的指定部分标记为“脏”。 |
| DirtyTextureRegion | 将地形纹理的指定部分标记为“脏”。 |
| GetAlphamaps | 返回位置 x、y 处给定宽度和高度的 Alpha 贴图。 |
| GetAlphamapTexture | 返回指定索引处的 Alpha 贴图纹理。 |
| GetClampedDetailPatches | Returns an array of detail patches, which are each identified by X-Z coordinates. Detail objects in the patches are clamped to the maximum count. |
| GetDetailLayer | Returns a 2D array of the detail object density (i.e. the number of detail objects for this layer) in the specific location. |
| GetHeight | Gets the world space height of the Terrain at a certain point x,y without adding the Terrain's world position y. |
| GetHeights | Gets an array of heightmap samples. |
| GetHoles | 获取地形孔洞样本数组。 |
| GetInterpolatedHeight | 获取点 (x,y) 处的插值高度。x 和 y 坐标钳制到 [0, 1] 内。 |
| GetInterpolatedHeights | 使用标准化 x,y 坐标获取地形高度值的数组。 |
| GetInterpolatedNormal | 获取给定位置处的插值法线。 |
| GetMaximumHeightError | 返回每个可渲染地形面片的曲面细分最大高度误差值数组。可以修改返回的数组并将其传递给 OverrideMaximumHeightError。 |
| GetPatchMinMaxHeights | 返回地形中所有可渲染面片的最小/最大高度值数组。可以修改返回的数组,然后将其传递给 OverrideMinMaxPatchHeights。 |
| GetSteepness | 获取点 (x,y) 处的地形梯度。 |
| GetSupportedLayers | 返回区域中所有支持的细节层索引的数组。 |
| GetTreeInstance | 获取指定索引处的树实例。该函数不创建整个树实例数组,因此可当作更快版本的 treeInstances[index] 使用。 |
| IsHole | 获取 x,y 处的特定点是否为孔洞。 |
| OverrideMaximumHeightError | 使用用户提供的值重写最大曲面细分高度误差。请注意,重写的值会在地形分辨率更改时重置,而在通过脚本绘制或更改地形高度贴图时保持不变。 |
| OverrideMinMaxPatchHeights | 重写每个可渲染地形面片的最小和最大面片高度。请注意,重写的值会在地形分辨率更改时重置,而在通过脚本绘制或更改地形高度贴图时保持不变。 |
| RefreshPrototypes | 重新加载 TerrainData 对象中可用原型(即细节网格资源)的所有值。 |
| SetAlphamaps | 在给定贴图区域中分配所有泼溅值。 |
| SetBaseMapDirty | 将地形数据标记为脏以触发地形基础贴图纹理的更新。 |
| SetDetailLayer | 设置细节层密度贴图。 |
| SetDetailResolution | 设置细节贴图的分辨率。 |
| SetHeights | 设置一个高度贴图样本数组。 |
| SetHeightsDelayLOD | 设置一个高度贴图样本数组。 |
| SetHoles | 设置地形孔洞样本数组。 |
| SetHolesDelayLOD | 设置地形孔洞样本数组。 |
| SetTerrainLayersRegisterUndo | 此函数设置 terrainLayers 属性,此外,将操作注册到编辑器的撤销堆栈。 |
| SetTreeInstance | 使用新参数在指定索引处设置树实例。但是,无法更改 TreeInstance.prototypeIndex 和 TreeInstance.position。如果更改它们,则该方法会抛出 ArgumentException。 |
| SetTreeInstances | 设置树实例数组,可以选择将树贴靠到地形高度贴图的表面上。 |
| SyncHeightmap | 执行按以前的 CopyActiveRenderTextureToHeightmap 和 DirtyHeightmapRegion 调用排队的同步,这可使用于曲面细分的高度数据和 LOD 数据保持最新状态。 |
| SyncTexture | 执行按以前的 CopyActiveRenderTextureToTexture 和 DirtyTextureRegion 调用排队的同步,这可使地形纹理的 CPU 数据保持最新状态。 |
| GetInstanceID | 返回对象的实例 ID。 |
| ToString | 返回对象的名称。 |
| Destroy | 移除 GameObject、组件或资源。 |
| DestroyImmediate | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 |
| DontDestroyOnLoad | 在加载新的 Scene 时,请勿销毁 Object。 |
| FindObjectOfType | 返回第一个类型为 type 的已加载的激活对象。 |
| FindObjectsOfType | Gets a list of all loaded objects of Type type. |
| Instantiate | 克隆 original 对象并返回克隆对象。 |
| bool | 该对象是否存在? |
| operator != | 比较两个对象是否引用不同的对象。 |
| operator == | 比较两个对象引用,判断它们是否引用同一个对象。 |