mirror of
https://github.com/BobbyRafael31/Unity-MazeRunner-Pathfinding-Visualizer.git
synced 2025-08-13 08:52:21 +00:00
feat saving include npc position
This commit is contained in:
@ -254,6 +254,9 @@ public class NPC : MonoBehaviour
|
||||
// Pre-allocate visualizationSteps with estimated capacity to avoid reallocations
|
||||
visualizationSteps = new List<PathfindingVisualizationStep>(4);
|
||||
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers(); // Tunggu semua finalizers selesai
|
||||
|
||||
// ===== MEMORY MEASUREMENT START: Ukur memory sebelum algoritma =====
|
||||
long memoryBefore = System.GC.GetTotalMemory(false);
|
||||
|
||||
@ -281,6 +284,13 @@ public class NPC : MonoBehaviour
|
||||
long memoryAfter = System.GC.GetTotalMemory(false);
|
||||
long memoryUsed = memoryAfter - memoryBefore;
|
||||
|
||||
// float miliseconds = algorithmTimer.ElapsedMilliseconds;
|
||||
|
||||
//UnityEngine.Debug.Log("$algorithmTimer.ElapsedTicks: " + algorithmTimer.ElapsedTicks);
|
||||
//UnityEngine.Debug.Log("$Stopwatch.Frequency: " + Stopwatch.Frequency);
|
||||
//float seconds = (float)algorithmTimer.ElapsedTicks / Stopwatch.Frequency;
|
||||
//UnityEngine.Debug.Log("$seconds: " + seconds);
|
||||
|
||||
float milliseconds = (algorithmTimer.ElapsedTicks * 1000.0f) / Stopwatch.Frequency;
|
||||
|
||||
// Calculate path length once and reuse
|
||||
@ -327,7 +337,7 @@ public class NPC : MonoBehaviour
|
||||
yield return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Setup callbacks for tracking nodes in open/closed lists and visualization
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user