Skip to content

Instantly share code, notes, and snippets.

@josephjaniga
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephjaniga/a2b33bed3b989bd2e1a4 to your computer and use it in GitHub Desktop.
Save josephjaniga/a2b33bed3b989bd2e1a4 to your computer and use it in GitHub Desktop.
Unity Stack Trace? Waypoint A* Pathing
/**
* NEW PATHING
*/
public void crunchPath(){
if ( !closed.Contains(destination) && open.Count > 0 ){
// get lowest F COST on open
setBestChoice();
current = bestChoice;
// move bestChoice to closed list
open.Remove(bestChoice);
closed.Add(bestChoice);
// for each adjacent 8 to current
foreach ( AStarNode n in getAdjacentNodes(current) ){
// ignore if not walkabled or already closed
if ( n.walkable && !closed.Contains(n) ){
// if not open
AStarNode temp = n;
if ( !open.Contains(temp) ){
// add to open, set this.parent = current, recalculate costs
temp.parent = current;
calculateCosts(current, ref temp, destination);
open.Add(temp);
} else if (temp.G < current.G) {
// else if open
// if cost is better than current G
// set this.parent = current, recalculate costs
temp.parent = current;
calculateCosts(current, ref temp, destination);
}
}
}
// another pass
crunchPath();
} else {
//DONE
Stack<AStarNode> tempWaypoints = new Stack<AStarNode>();
AStarNode n = destination;
while ( n != null ){
tempWaypoints.Push(n);
n = n.parent;
}
if ( waypoints != tempWaypoints ){
waypoints.Clear();
waypoints = tempWaypoints;
waypointDisplay = new AStarNode[waypoints.Count];
waypointDisplay = waypoints.ToArray();
gameObject.SendMessage("PathCalculated", SendMessageOptions.DontRequireReceiver);
}
}
}
public void setBestChoice(){
bestChoice = null;
// assign values to the opens
for ( int i=0; i<open.Count; i++ ){
AStarNode temp = open[i];
calculateCosts(current, ref temp, destination);
if ( bestChoice == null ){
bestChoice = temp;
} else {
if ( bestChoice.F > temp.F ){
bestChoice = temp;
}
}
}
}
Launching bug reporter
Obtained 41 stack frames.
#0 0x007fff9a17ff09 in _platform_bzero$VARIANT$Ivybridge
#1 0x0000010575ed14 in GC_generic_malloc
#2 0x0000010575ee8b in GC_malloc
#3 0x000001056ed6f1 in mono_array_new_specific
#4 0x00000105ded963 in (Unknown)
#5 0x00000129c80d48 in System.Array:Resize<object> (object[]&,int,int) + 0x1a8 (0x129c80ba0 0x129c80dca) [0x10cd4c660 - Unity Child Domain]
#6 0x00000129c80b61 in System.Array:Resize<object> (object[]&,int) + 0xc1 (0x129c80aa0 0x129c80b85) [0x10cd4c660 - Unity Child Domain]
#7 0x0000017ceedf5b in System.Collections.Generic.Stack`1<object>:Push (object) + 0x11b (0x17ceede40 0x17ceee003) [0x10cd4c660 - Unity Child Domain]
#8 0x0000017cf24738 in AStarPathfinder:crunchPath () + 0x6f8 (0x17cf24040 0x17cf248d0) [0x10cd4c660 - Unity Child Domain]
#9 0x0000017cf24654 in AStarPathfinder:crunchPath () + 0x614 (0x17cf24040 0x17cf248d0) [0x10cd4c660 - Unity Child Domain]
#10 0x0000017cf24654 in AStarPathfinder:crunchPath () + 0x614 (0x17cf24040 0x17cf248d0) [0x10cd4c660 - Unity Child Domain]
#11 0x0000017cf24654 in AStarPathfinder:crunchPath () + 0x614 (0x17cf24040 0x17cf248d0) [0x10cd4c660 - Unity Child Domain]
#12 0x0000017cf24654 in AStarPathfinder:crunchPath () + 0x614 (0x17cf24040 0x17cf248d0) [0x10cd4c660 - Unity Child Domain]
#13 0x0000017cf24654 in AStarPathfinder:crunchPath () + 0x614 (0x17cf24040 0x17cf248d0) [0x10cd4c660 - Unity Child Domain]
#14 0x0000017cf23781 in AStarPathfinder:Update () + 0xf1 (0x17cf23690 0x17cf23827) [0x10cd4c660 - Unity Child Domain]
#15 0x000001290d66ca in (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0xfa (0x1290d65d0 0x1290d67fd) [0x10cd4c660 - Unity Child Domain]
#16 0x000001055c2dcc in mono_get_runtime_build_info
#17 0x000001056e6cb7 in mono_runtime_invoke
#18 0x0000010072df27 in ScriptingInvocationNoArgs::Invoke(MonoException**)
#19 0x0000010072deb9 in ScriptingInvocationNoArgs::Invoke()
#20 0x000001007118a1 in MonoBehaviour::CallMethodIfAvailable(int)
#21 0x00000100439e96 in void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
#22 0x00000100609cdf in PlayerLoop(bool, bool, IHookEvent*)
#23 0x00000101003e55 in Application::UpdateScene(bool)
#24 0x00000100fff6d8 in Application::TickTimer()
#25 0x007fff93f40023 in __NSFireTimer
#26 0x007fff8cf33b44 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#27 0x007fff8cf337d3 in __CFRunLoopDoTimer
#28 0x007fff8cfa6d9d in __CFRunLoopDoTimers
#29 0x007fff8cef0268 in __CFRunLoopRun
#30 0x007fff8ceef838 in CFRunLoopRunSpecific
#31 0x007fff9614c43f in RunCurrentEventLoopInMode
#32 0x007fff9614c1ba in ReceiveNextEventCommon
#33 0x007fff9614bffb in _BlockUntilNextEventMatchingListInModeWithFilter
#34 0x007fff942c56d1 in _DPSNextEvent
#35 0x007fff942c4e80 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#36 0x007fff942b8e23 in -[NSApplication run]
#37 0x007fff942a42d4 in NSApplicationMain
#38 0x000001011eb4ae in EditorMain(int, char const**)
#39 0x000001011ebc09 in main
#40 0x00000100001d44 in start
Symbol file LoadedFromMemory doesn't match image /Applications/Unity/Unity.app/Contents/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll
Symbol file /Applications/Unity/Unity.app/Contents/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll.mdb doesn't match image /Applications/Unity/Unity.app/Contents/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll
Launching external process: /Applications/Unity/Unity.app/Contents/BugReporter/Unity Bug Reporter.app/Contents/MacOS/unity.bugreporter.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment