A* Pathfinding Project  4.0.6
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
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.
 
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)
 Handle serialization backwards compatibility.
 

Member Function Documentation

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

Member Data Documentation

int allocMem = 0
private
int allocRate = 0
private
Rect boxRect
private
string cachedText
private
Camera cam
private
int collectAlloc = 0
private
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)))
}
float delayedDeltaTime = 1
private
float delta = 0
private
Font font = null

Font to use.

A monospaced font is the best

int fontSize = 12
int fpsDropCounterSize = 200
private
float [] fpsDrops
private
GraphPoint [] graph
private
int graphBufferSize = 200
float graphHeight = 100
private
float graphOffset = 50
private
float graphWidth = 100
private
int lastAllocMemory = 0
private
float lastAllocSet = -9999
private
float lastCollect = 0
private
float lastCollectNum = 0
private
float lastDeltaTime = 0
private
float lastUpdate = -999
private
int maxNodePool = 0
private
int maxVecPool = 0
private
int peakAlloc = 0
private
bool show = true
bool showFPS = false
bool showGraph = false
bool showInEditor = false
bool showMemProfile = false
bool showPathProfile = false
GUIStyle style
private
StringBuilder text = new StringBuilder()
private
int yOffset = 5

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