- Home /
EditorUtility.DisplayDialog memory Issue
Hi I'm developing an AI system and at some points in the development / Analyse scene time, I need to first confirm if the user want to do part of analysis or he would like to bypass one section and continue the rest, so I want to ask about process and if he agree do that and then move on to the next, each process has a progress bar showing up that indicates one on one run of internal cycle of the method and sometimes that cycle happens for 18,000 time each method, the code is like this :
bool ok = EditorUtility.DisplayDialog("Analyze", "Analyze the scene? Depending on multi factors, this may take minutes!",
"Ok", "Cacel");
if (ok)
{
bool neighb = EditorUtility.DisplayDialog("Analyze", "Generate Neighbour Lookup Table?", "Ok", "Cacel");
if (neighb)
{
CollectNeighborData();
}
EditorUtility.ClearProgressBar();
bool rang = EditorUtility.DisplayDialog("Analyze", "Generate Inrange Lookup Table?", "Ok", "Cacel");
if (rang)
{
CollectInRangeData();
}
EditorUtility.ClearProgressBar();
bool zon = EditorUtility.DisplayDialog("Analyze", "Generate zones?", "Ok", "Cacel");
if (zon)
{
CollectZoneData(_zoneX, _zoneZ);
}
EditorUtility.ClearProgressBar();
bool vis = EditorUtility.DisplayDialog("Analyze", "Generate Line of Sight Lookup Table?", "Ok", "Cacel");
if (vis)
{
CollectLineOfSightData();
}
EditorUtility.ClearProgressBar();
bool ser = EditorUtility.DisplayDialog("Serialization", "Serialize Data? If you cancel, all calculated Analisis will be lost on project update.", "Ok", "Cacel");
if (ser)
{
Nodes.SaveNodes();
}
EditorUtility.ClearProgressBar();
}
each of the methods is more or less like this, this is the smallest one so I put it in the code but others are also similar in the aspect that they have internal loops and at the end of the loop I update the progress bar :
void CollectNeighborData()
{
Stopwatch sw = new Stopwatch();
sw.Start();
Nodes.Neighbours = new Dictionary<Node, List<Node>>();
List<Node> neighbours = new List<Node>();
int k = 0;
foreach (var node in Nodes.AllNodes)
{
neighbours = GridHandler.GetNeighbourNodes(node, Nodes.Gap);
Nodes.Neighbours.Add(node, neighbours);
EditorUtility.DisplayProgressBar(
"Neighbour Data",
"Collecting Data Lookup Table for Node Neighbours",
k / (float)Nodes.AllNodes.Count);
k++;
}
sw.Stop();
Debug.Log("Neighbour Data Table in : " + sw.ElapsedMilliseconds + " ms = " + sw.Elapsed);
}
Now the problem is after the first two questions is being shown and the first progress bar finish his job, I get this error :
Error displaying dialog: The current process has used all of its system allowance of handles for Window Manager objects.
UnityEditor.EditorUtility:DisplayDialog(String, String, String, String)
GridGeneratorEditor:analyseScene() (at Assets/UnityAI.net/Editor/GridGeneratorEditor.cs:229)
GridGeneratorEditor:OnInspectorGUI() (at Assets/UnityAI.net/Editor/GridGeneratorEditor.cs:76)
UnityEditor.DockArea:OnGUI()
I think it's more about some memory being used by GUI stuff and not being released, so the question is how to fix this issue?
thanks.
Your answer
Follow this Question
Related Questions
What are all these warnings about? 0 Answers
"Fatal error! CheckDisalowAllowcation" when making a huge 2d array 2 Answers
m_Memory.renderTextureBytes<0 1 Answer
[CRASH] Memory can not be "read" / "write" 1 Answer
RAM problem on mobile phone? 0 Answers