После поиска в Google, я думаю, что это утечка памяти, но я не знаю, как это исправить.
Утверждение не выполнено: TLS Allocator ALLOC_TEMP_THREAD, базовый распределитель ALLOC_TEMP_THREAD имеет несвободные выделения, размер 1528
Я использую Unity 2018.1.0.0f2.
Вот скрипт, который вызывает ошибку (извините за мои ужасные навыки организации кода, новичок в мире поколения)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WorldGeneration : MonoBehaviour {
public float GenerationDelay;
public float RoomPicker;
public float LevelNumber;
public float RoomCount;
public float MaxRoomCount;
public float LevelSample1Rooms;
public float MaxLevelSample1Rooms;
public float LevelSample2Rooms;
public float MaxLevelSample2Rooms;
public float LevelSample3Rooms;
public float MaxLevelSample3Rooms;
public float LevelSample4Rooms;
public float MaxLevelSample4Rooms;
public float LevelSample5Rooms;
public float MaxLevelSample5Rooms;
public GameObject LevelSample1;
public GameObject LevelSample2;
public GameObject LevelSample3;
public GameObject LevelSample4;
public GameObject LevelSample5;
public Transform SpawnLevelPoint;
public Transform SpawnLevelPoint1;
public bool Leveloadedatpoint1;
public Transform SpawnLevelPoint2;
public bool Leveloadedatpoint2;
public Transform SpawnLevelPoint3;
public bool Leveloadedatpoint3;
public Transform SpawnLevelPoint4;
public bool Leveloadedatpoint4;
public Transform SpawnLevelPoint5;
public bool Leveloadedatpoint5;
public Transform SpawnLevelPoint6;
public bool Leveloadedatpoint6;
void Start()
{
StartCoroutine("Createpoint1room");
}
public IEnumerator Createpoint1room()
{
if (Leveloadedatpoint1 == false)
{
RoomPicker = Random.Range(1, 20);
yield return new WaitForSeconds(GenerationDelay);
if (RoomPicker == 1 || RoomPicker == 2 || RoomPicker == 3 || RoomPicker == 4 || RoomPicker == 5)
{
if (Leveloadedatpoint1 == false)
{
if (LevelSample1Rooms < MaxLevelSample1Rooms)
{
LevelSample1Rooms += 1;
Instantiate(LevelSample1, SpawnLevelPoint1.transform.position, Quaternion.identity);
Leveloadedatpoint1 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint2room");
}
else
{
StartCoroutine("Createpoint1room");
}
}
else
{
StartCoroutine("Createpoint1room");
}
}
if (RoomPicker == 6 || RoomPicker == 7 || RoomPicker == 8)
{
if (Leveloadedatpoint1 == false)
{
if (LevelSample2Rooms < MaxLevelSample2Rooms)
{
LevelSample2Rooms += 1;
Instantiate(LevelSample2, SpawnLevelPoint1.transform.position, Quaternion.identity);
Leveloadedatpoint1 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint2room");
}
else
{
StartCoroutine("Createpoint1room");
}
}
else
{
StartCoroutine("Createpoint1room");
}
}
if (RoomPicker == 9 || RoomPicker == 10 || RoomPicker == 11)
{
if (Leveloadedatpoint1 == false)
{
if (LevelSample3Rooms < MaxLevelSample3Rooms)
{
LevelSample3Rooms += 1;
Instantiate(LevelSample3, SpawnLevelPoint1.transform.position, Quaternion.identity);
Leveloadedatpoint1 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint2room");
}
else
{
StartCoroutine("Createpoint1room");
}
}
else
{
StartCoroutine("Createpoint1room");
}
}
if (RoomPicker == 12 || RoomPicker == 13 || RoomPicker == 14)
{
if (Leveloadedatpoint1 == false)
{
if (LevelSample4Rooms < MaxLevelSample4Rooms)
{
LevelSample4Rooms += 1;
Instantiate(LevelSample4, SpawnLevelPoint1.transform.position, Quaternion.identity);
Leveloadedatpoint1 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint2room");
}
else
{
StartCoroutine("Createpoint1room");
}
}
else
{
StartCoroutine("Createpoint1room");
}
}
if (RoomPicker == 15 || RoomPicker == 16 || RoomPicker == 17)
{
if (Leveloadedatpoint1 == false)
{
if (LevelSample5Rooms < MaxLevelSample5Rooms)
{
LevelSample5Rooms += 1;
Instantiate(LevelSample5, SpawnLevelPoint1.transform.position, Quaternion.identity);
Leveloadedatpoint1 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint2room");
}
else
{
StartCoroutine("Createpoint1room");
}
}
else
{
StartCoroutine("Createpoint1room");
}
}
if (RoomPicker == 18 || RoomPicker == 19 || RoomPicker == 20)
{
StartCoroutine("Createpoint1room");
}
Debug.Log("Point 1: The number is " + RoomPicker);
}
else
{
StartCoroutine("Createpoint2room");
}
}
public IEnumerator Createpoint2room()
{
if (Leveloadedatpoint2 == false)
{
RoomPicker = Random.Range(1, 20);
yield return new WaitForSeconds(GenerationDelay);
if (RoomPicker == 1 || RoomPicker == 2 || RoomPicker == 3 || RoomPicker == 4 || RoomPicker == 5)
{
if (Leveloadedatpoint2 == false)
{
if (LevelSample1Rooms < MaxLevelSample1Rooms)
{
LevelSample1Rooms += 1;
Instantiate(LevelSample1, SpawnLevelPoint2.transform.position, Quaternion.identity);
Leveloadedatpoint2 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint3room");
}
else
{
StartCoroutine("Createpoint2room");
}
}
else
{
StartCoroutine("Createpoint2room");
}
}
if (RoomPicker == 6 || RoomPicker == 7 || RoomPicker == 8)
{
if (Leveloadedatpoint2 == false)
{
if (LevelSample2Rooms < MaxLevelSample2Rooms)
{
LevelSample2Rooms += 1;
Instantiate(LevelSample2, SpawnLevelPoint2.transform.position, Quaternion.identity);
Leveloadedatpoint2 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint3room");
}
else
{
StartCoroutine("Createpoint2room");
}
}
else
{
StartCoroutine("Createpoint2room");
}
}
if (RoomPicker == 9 || RoomPicker == 10 || RoomPicker == 11)
{
if (Leveloadedatpoint2 == false)
{
if (LevelSample3Rooms < MaxLevelSample3Rooms)
{
LevelSample3Rooms += 1;
Instantiate(LevelSample3, SpawnLevelPoint2.transform.position, Quaternion.identity);
Leveloadedatpoint2 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint3room");
}
else
{
StartCoroutine("Createpoint2room");
}
}
else
{
StartCoroutine("Createpoint2room");
}
}
if (RoomPicker == 12 || RoomPicker == 13 || RoomPicker == 14)
{
if (Leveloadedatpoint2 == false)
{
if (LevelSample4Rooms < MaxLevelSample4Rooms)
{
LevelSample4Rooms += 1;
Instantiate(LevelSample4, SpawnLevelPoint2.transform.position, Quaternion.identity);
Leveloadedatpoint2 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint3room");
}
else
{
StartCoroutine("Createpoint2room");
}
}
else
{
StartCoroutine("Createpoint2room");
}
}
if (RoomPicker == 15 || RoomPicker == 16 || RoomPicker == 17)
{
if (Leveloadedatpoint2 == false)
{
if (LevelSample5Rooms < MaxLevelSample5Rooms)
{
LevelSample5Rooms += 1;
Instantiate(LevelSample5, SpawnLevelPoint2.transform.position, Quaternion.identity);
Leveloadedatpoint2 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint3room");
}
else
{
StartCoroutine("Createpoint2room");
}
}
else
{
StartCoroutine("Createpoint2room");
}
}
if (RoomPicker == 18 || RoomPicker == 19 || RoomPicker == 20)
{
StartCoroutine("Createpoint2room");
}
Debug.Log("Point 2: The number is " + RoomPicker);
}
else
{
StartCoroutine("Createpoint3room");
}
}
public IEnumerator Createpoint3room()
{
if (Leveloadedatpoint3 == false)
{
RoomPicker = Random.Range(1, 20);
yield return new WaitForSeconds(GenerationDelay);
if (RoomPicker == 1 || RoomPicker == 2 || RoomPicker == 3 || RoomPicker == 4 || RoomPicker == 5)
{
if (Leveloadedatpoint3 == false)
{
if (LevelSample1Rooms < MaxLevelSample1Rooms)
{
LevelSample1Rooms += 1;
Instantiate(LevelSample1, SpawnLevelPoint3.transform.position, Quaternion.identity);
Leveloadedatpoint3 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint4room");
}
else
{
StartCoroutine("Createpoint3room");
}
}
else
{
StartCoroutine("Createpoint3room");
}
}
if (RoomPicker == 6 || RoomPicker == 7 || RoomPicker == 8)
{
if (Leveloadedatpoint3 == false)
{
if (LevelSample2Rooms < MaxLevelSample2Rooms)
{
LevelSample2Rooms += 1;
Instantiate(LevelSample2, SpawnLevelPoint3.transform.position, Quaternion.identity);
Leveloadedatpoint3 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint4room");
}
else
{
StartCoroutine("Createpoint3room");
}
}
else
{
StartCoroutine("Createpoint3room");
}
}
if (RoomPicker == 9 || RoomPicker == 10 || RoomPicker == 11)
{
if (Leveloadedatpoint3 == false)
{
if (LevelSample3Rooms < MaxLevelSample3Rooms)
{
LevelSample3Rooms += 1;
Instantiate(LevelSample3, SpawnLevelPoint3.transform.position, Quaternion.identity);
Leveloadedatpoint3 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint4room");
}
else
{
StartCoroutine("Createpoint3room");
}
}
else
{
StartCoroutine("Createpoint3room");
}
}
if (RoomPicker == 12 || RoomPicker == 13 || RoomPicker == 14)
{
if (Leveloadedatpoint3 == false)
{
if (LevelSample4Rooms < MaxLevelSample4Rooms)
{
LevelSample4Rooms += 1;
Instantiate(LevelSample4, SpawnLevelPoint3.transform.position, Quaternion.identity);
Leveloadedatpoint3 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint4room");
}
else
{
StartCoroutine("Createpoint3room");
}
}
else
{
StartCoroutine("Createpoint3room");
}
}
if (RoomPicker == 15 || RoomPicker == 16 || RoomPicker == 17)
{
if (Leveloadedatpoint3 == false)
{
if (LevelSample5Rooms < MaxLevelSample5Rooms)
{
LevelSample5Rooms += 1;
Instantiate(LevelSample5, SpawnLevelPoint3.transform.position, Quaternion.identity);
Leveloadedatpoint3 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint4room");
}
else
{
StartCoroutine("Createpoint3room");
}
}
else
{
StartCoroutine("Createpoint3room");
}
}
if (RoomPicker == 18 || RoomPicker == 19 || RoomPicker == 20)
{
StartCoroutine("Createpoint3room");
}
Debug.Log("Point 3: The number is " + RoomPicker);
}
else
{
StartCoroutine("Createpoint4room");
}
}
public IEnumerator Createpoint4room()
{
if (Leveloadedatpoint4 == false)
{
RoomPicker = Random.Range(1, 20);
yield return new WaitForSeconds(GenerationDelay);
if (RoomPicker == 1 || RoomPicker == 2 || RoomPicker == 3 || RoomPicker == 4 || RoomPicker == 5)
{
if (Leveloadedatpoint4 == false)
{
if (LevelSample1Rooms < MaxLevelSample1Rooms)
{
LevelSample1Rooms += 1;
Instantiate(LevelSample1, SpawnLevelPoint4.transform.position, Quaternion.identity);
Leveloadedatpoint4 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint5room");
}
else
{
StartCoroutine("Createpoint4room");
}
}
else
{
StartCoroutine("Createpoint4room");
}
}
if (RoomPicker == 6 || RoomPicker == 7 || RoomPicker == 8)
{
if (Leveloadedatpoint4 == false)
{
if (LevelSample2Rooms < MaxLevelSample2Rooms)
{
LevelSample2Rooms += 1;
Instantiate(LevelSample2, SpawnLevelPoint4.transform.position, Quaternion.identity);
Leveloadedatpoint4 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint5room");
}
else
{
StartCoroutine("Createpoint4room");
}
}
else
{
StartCoroutine("Createpoint4room");
}
}
if (RoomPicker == 9 || RoomPicker == 10 || RoomPicker == 11)
{
if (Leveloadedatpoint4 == false)
{
if (LevelSample3Rooms < MaxLevelSample3Rooms)
{
LevelSample3Rooms += 1;
Instantiate(LevelSample3, SpawnLevelPoint4.transform.position, Quaternion.identity);
Leveloadedatpoint4 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint5room");
}
else
{
StartCoroutine("Createpoint4room");
}
}
else
{
StartCoroutine("Createpoint4room");
}
}
if (RoomPicker == 12 || RoomPicker == 13 || RoomPicker == 14)
{
if (Leveloadedatpoint4 == false)
{
if (LevelSample4Rooms < MaxLevelSample4Rooms)
{
LevelSample4Rooms += 1;
Instantiate(LevelSample4, SpawnLevelPoint4.transform.position, Quaternion.identity);
Leveloadedatpoint3 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint4room");
}
else
{
StartCoroutine("Createpoint4room");
}
}
else
{
StartCoroutine("Createpoint4room");
}
}
if (RoomPicker == 15 || RoomPicker == 16 || RoomPicker == 17)
{
if (Leveloadedatpoint3 == false)
{
if (LevelSample5Rooms < MaxLevelSample5Rooms)
{
LevelSample5Rooms += 1;
Instantiate(LevelSample5, SpawnLevelPoint4.transform.position, Quaternion.identity);
Leveloadedatpoint3 = true;
yield return new WaitForSeconds(GenerationDelay);
StartCoroutine("Createpoint5room");
}
else
{
StartCoroutine("Createpoint4room");
}
}
else
{
StartCoroutine("Createpoint4room");
}
}
if (RoomPicker == 18 || RoomPicker == 19 || RoomPicker == 20)
{
StartCoroutine("Createpoint4room");
}
Debug.Log("Point 4: The number is " + RoomPicker);
}
else
{
StartCoroutine("Createpoint4room");
}
}
public IEnumerator Createpoint5room()
{
yield return new WaitForSeconds(GenerationDelay);
Debug.Log("Generation finished");
}
}
Edit1:
Эта ошибка также может привести к сбою моего редактора и к сбою сборки игры.