void SyncCPUTexture( Sandbox.Terrain/SyncFlags flags, RectInt region )

book_4_sparkGenerated
code_blocksInput

Description

The SyncCPUTexture method is a member of the Terrain class in the Sandbox namespace. This method is responsible for synchronizing the CPU texture with the GPU texture maps by downloading the dirty regions from the GPU. This process updates the collider data and makes any changes saveable. It is typically used from the editor after modifications have been made to the terrain.

Usage

To use the SyncCPUTexture method, you need to specify the regions of the texture that need to be synchronized and the flags that determine the synchronization behavior. The method takes two parameters:

  • flags: A SyncFlags enumeration that specifies the synchronization options.
  • region: A RectInt structure that defines the rectangular region of the texture to be synchronized.

Example

// Example usage of SyncCPUTexture
Terrain terrain = new Terrain();

// Define the region to sync
RectInt region = new RectInt(0, 0, 512, 512);

// Define the sync flags
Terrain.SyncFlags flags = Terrain.SyncFlags.All;

// Synchronize the CPU texture with the specified region and flags
terrain.SyncCPUTexture(flags, region);