public static void SetTextures(VegetationSystemPro system, VegetationPackagePro package, Texture2D[] textures, int[] maskGroupNums, Rect terrainRect) { for (int i = 0; i < textures.Length; i++) { Texture2D tex = textures[i]; if (tex == null) { continue; } TextureMaskGroup maskGroup = package.TextureMaskGroupList[maskGroupNums[i]]; //creating new mask only if the mask with the same rect doesn't exist TextureMask mask = maskGroup.TextureMaskList.Find(m => m.TextureRect == terrainRect); if (mask == null) { mask = new TextureMask { TextureRect = terrainRect }; maskGroup.TextureMaskList.Add(mask); } mask.MaskTexture = tex; } //VegetationSystemPro system = GameObject.FindObjectOfType<VegetationSystemPro>(); //if (system != null) // system.ClearCache(); //clearing cache causes flickering system.RefreshTerrainHeightmap(); }
public static void RefreshVegetation() { VegetationStudioManager VegetationStudioInstance = FindVegetationStudioInstance(); List <VegetationSystemPro> VegetationSystemList = VegetationStudioInstance.VegetationSystemList; for (int i = 0; i <= VegetationSystemList.Count - 1; i++) { VegetationSystemPro vegetationSystemPro = VegetationSystemList[i]; vegetationSystemPro.ClearCache(); vegetationSystemPro.RefreshTerrainHeightmap(); SceneView.RepaintAll(); SetSceneDirty(vegetationSystemPro); } }