/// <summary> /// Generate a sector and assign it to the UNTerrain. /// </summary> /// <param name="sectorResolution">How many pieces will the terrain be divided to? the bigger it is the more pieces.</param> public virtual UNTerrainSector GenerateSector(int sectorResolution, bool multiThread) { _sector = Sector.GenerateSector <UNTerrainSector, TIChunk>(transform, terrainData.terrainData.size, _sector, sectorResolution); return(_sector); }
/// <summary> /// Initiate startup variables /// </summary> protected override void Awake() { UNTreePrototype.CheckForMissings(terrainData.treePrototypes, terrain.terrainData.treePrototypes); var sectors = GetComponentsInChildren <UNTerrainSector>(); if (sectors.Length > 1) // if there's more than 1 sectors. { for (int i = 0; i < sectors.Length; i++) { GameObject.DestroyImmediate(sectors[i].gameObject); } _sector = null; } if (sector == null) { GenerateSector(sectorResolution); } if (Pool == null) { CreatePool(PoolItemType); } ThreadManager.InitializeIfNotAvailable(); // try to initialize if thread manager doesnt exist... if (!this.enabled) { return; } if (!Application.isPlaying) { return; } terrain = GetComponent <Terrain>(); base.Awake(); if (UNSettings.instance.UN_TreeInstancesRespawnsEnabled) { InvokeRepeating("CheckForTreeInstancesRespawns", 5, 5); } }