A* Pathfinding Project  4.1.12
The A* Pathfinding Project for Unity 3D
AstarDebugger Class Reference

Debugger for the A* Pathfinding Project. More...

Detailed Description

Debugger for the A* Pathfinding Project.

This class can be used to profile different parts of the pathfinding system and the whole game as well to some extent.

Clarification of the labels shown when enabled. All memory related things profiles the whole game not just the A* Pathfinding System.

  • Currently allocated: memory the GC (garbage collector) says the application has allocated right now.
  • Peak allocated: maximum measured value of the above.
  • Last collect peak: the last peak of 'currently allocated'.
  • Allocation rate: how much the 'currently allocated' value increases per second. This value is not as reliable as you can think it is often very random probably depending on how the GC thinks this application is using memory.
  • Collection frequency: how often the GC is called. Again, the GC might decide it is better with many small collections or with a few large collections. So you cannot really trust this variable much.
  • Last collect fps: FPS during the last garbage collection, the GC will lower the fps a lot.
  • FPS: current FPS (not updated every frame for readability)
  • Lowest FPS (last x): As the label says, the lowest fps of the last x frames.
  • Size: Size of the path pool.
  • Total created: Number of paths of that type which has been created. Pooled paths are not counted twice. If this value just keeps on growing and growing without an apparent stop, you are are either not pooling any paths or you have missed to pool some path somewhere in your code.
See also
pooling
Todo:
Add field showing how many graph updates are being done right now

Classes

struct  GraphPoint
 
struct  PathTypeDebug
 

Public Member Functions

void LateUpdate ()
 
void OnGUI ()
 
void Start ()
 

Public Attributes

Font font = null
 Font to use. More...
 
int fontSize = 12
 
int graphBufferSize = 200
 
bool show = true
 
bool showFPS = false
 
bool showGraph = false
 
bool showInEditor = false
 
bool showMemProfile = false
 
bool showPathProfile = false
 
int yOffset = 5
 

Private Member Functions

void DrawGraphLine (int index, Matrix4x4 m, float x1, float x2, float y1, float y2, Color color)
 

Private Attributes

int allocMem = 0
 
int allocRate = 0
 
Rect boxRect
 
string cachedText
 
Camera cam
 
int collectAlloc = 0
 
PathTypeDebug [] debugTypes
 
float delayedDeltaTime = 1
 
float delta = 0
 
int fpsDropCounterSize = 200
 
float [] fpsDrops
 
GraphPoint [] graph
 
float graphHeight = 100
 
float graphOffset = 50
 
float graphWidth = 100
 
int lastAllocMemory = 0
 
float lastAllocSet = -9999
 
float lastCollect = 0
 
float lastCollectNum = 0
 
float lastDeltaTime = 0
 
float lastUpdate = -999
 
int maxNodePool = 0
 
int maxVecPool = 0
 
int peakAlloc = 0
 
GUIStyle style
 
StringBuilder text = new StringBuilder()
 

Additional Inherited Members

- Protected Member Functions inherited from VersionedMonoBehaviour
virtual void Awake ()
 
virtual int OnUpgradeSerializedData (int version, bool unityThread)
 Handle serialization backwards compatibility. More...
 

Member Function Documentation

◆ DrawGraphLine()

void DrawGraphLine ( int  index,
Matrix4x4  m,
float  x1,
float  x2,
float  y1,
float  y2,
Color  color 
)
private

◆ LateUpdate()

void LateUpdate ( )

◆ OnGUI()

void OnGUI ( )

◆ Start()

void Start ( )

Member Data Documentation

◆ allocMem

int allocMem = 0
private

◆ allocRate

int allocRate = 0
private

◆ boxRect

Rect boxRect
private

◆ cachedText

string cachedText
private

◆ cam

Camera cam
private

◆ collectAlloc

int collectAlloc = 0
private

◆ debugTypes

PathTypeDebug [] debugTypes
private
Initial value:
= new PathTypeDebug[] {
new PathTypeDebug("ABPath", () => PathPool.GetSize(typeof(ABPath)), () => PathPool.GetTotalCreated(typeof(ABPath)))
,
new PathTypeDebug("MultiTargetPath", () => PathPool.GetSize(typeof(MultiTargetPath)), () => PathPool.GetTotalCreated(typeof(MultiTargetPath))),
new PathTypeDebug("RandomPath", () => PathPool.GetSize(typeof(RandomPath)), () => PathPool.GetTotalCreated(typeof(RandomPath))),
new PathTypeDebug("FleePath", () => PathPool.GetSize(typeof(FleePath)), () => PathPool.GetTotalCreated(typeof(FleePath))),
new PathTypeDebug("ConstantPath", () => PathPool.GetSize(typeof(ConstantPath)), () => PathPool.GetTotalCreated(typeof(ConstantPath))),
new PathTypeDebug("FloodPath", () => PathPool.GetSize(typeof(FloodPath)), () => PathPool.GetTotalCreated(typeof(FloodPath))),
new PathTypeDebug("FloodPathTracer", () => PathPool.GetSize(typeof(FloodPathTracer)), () => PathPool.GetTotalCreated(typeof(FloodPathTracer)))
}

◆ delayedDeltaTime

float delayedDeltaTime = 1
private

◆ delta

float delta = 0
private

◆ font

Font font = null

Font to use.

A monospaced font is the best

◆ fontSize

int fontSize = 12

◆ fpsDropCounterSize

int fpsDropCounterSize = 200
private

◆ fpsDrops

float [] fpsDrops
private

◆ graph

GraphPoint [] graph
private

◆ graphBufferSize

int graphBufferSize = 200

◆ graphHeight

float graphHeight = 100
private

◆ graphOffset

float graphOffset = 50
private

◆ graphWidth

float graphWidth = 100
private

◆ lastAllocMemory

int lastAllocMemory = 0
private

◆ lastAllocSet

float lastAllocSet = -9999
private

◆ lastCollect

float lastCollect = 0
private

◆ lastCollectNum

float lastCollectNum = 0
private

◆ lastDeltaTime

float lastDeltaTime = 0
private

◆ lastUpdate

float lastUpdate = -999
private

◆ maxNodePool

int maxNodePool = 0
private

◆ maxVecPool

int maxVecPool = 0
private

◆ peakAlloc

int peakAlloc = 0
private

◆ show

bool show = true

◆ showFPS

bool showFPS = false

◆ showGraph

bool showGraph = false

◆ showInEditor

bool showInEditor = false

◆ showMemProfile

bool showMemProfile = false

◆ showPathProfile

bool showPathProfile = false

◆ style

GUIStyle style
private

◆ text

StringBuilder text = new StringBuilder()
private

◆ yOffset

int yOffset = 5

The documentation for this class was generated from the following file: