{"id":13663191,"url":"https://github.com/mattatz/unity-path-finding","last_synced_at":"2025-07-26T12:10:31.223Z","repository":{"id":151395065,"uuid":"127386299","full_name":"mattatz/unity-path-finding","owner":"mattatz","description":"Shortest path finding with Dijkstra's algorithm for Unity.","archived":false,"fork":false,"pushed_at":"2018-04-16T01:52:16.000Z","size":13288,"stargazers_count":125,"open_issues_count":0,"forks_count":29,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-12T20:33:33.037Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattatz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-30T05:40:20.000Z","updated_at":"2025-06-09T05:38:48.000Z","dependencies_parsed_at":"2023-07-06T20:00:47.671Z","dependency_job_id":null,"html_url":"https://github.com/mattatz/unity-path-finding","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mattatz/unity-path-finding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattatz%2Funity-path-finding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattatz%2Funity-path-finding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattatz%2Funity-path-finding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattatz%2Funity-path-finding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattatz","download_url":"https://codeload.github.com/mattatz/unity-path-finding/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattatz%2Funity-path-finding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267163747,"owners_count":24045707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:02:20.566Z","updated_at":"2025-07-26T12:10:31.199Z","avatar_url":"https://github.com/mattatz.png","language":"C#","readme":"unity-path-finding\n=====================\n\n![Demo](https://raw.githubusercontent.com/mattatz/unity-path-finding/master/Captures/Demo.gif)\n\n![PathRenderer](https://raw.githubusercontent.com/mattatz/unity-path-finding/master/Captures/PathRenderer.gif)\n\nShortest path finding with Dijkstra's algorithm for Unity.\n\n## Usage (2D grid nodes example)\n\n```cs\nvar nodes = new List\u003cNode\u003e();\nvar edges = new List\u003cEdge\u003e();\n\n// grid size\nint width = 10, height = 10;\n\n// create nodes on grid\n\nfor(int y = 0; y \u003c height; y++)\n{\n    for(int x = 0; x \u003c width; x++)\n    {\n        var node = new Node(new Vector3(x, 0, y));\n        nodes.Add(node);\n    }\n}\n\n// connect edges between neighbor nodes on grid\nfor(int y = 0; y \u003c height; y++)\n{\n    var yoff = y * width;\n    for(int x = 0; x \u003c width; x++)\n    {\n        var idx = yoff + x;\n        var node = nodes[idx];\n\n        // connect horizontally\n        if(x \u003c width - 1)\n        {\n            var to = nodes[idx + 1];\n            var e = node.Connect(to, Vector3.Distance(node.Position, to.Position));\n            edges.Add(e);\n        }\n\n        // connect vertically\n        if(y \u003c height - 1)\n        {\n            var to = nodes[idx + width];\n            var e = node.Connect(to, Vector3.Distance(node.Position, to.Position));\n            edges.Add(e);\n        }\n    }\n}\n\n// create graph\nvar graph = new Graph(nodes, edges);\n\n// build a Path with shortest path finding from source\nint source = 0; // source node index\nPath route = graph.Find(source);\n\n// traverse a route from source to destination\nint destination = 84; // destination node index\n\n// traverse nodes from destination to source\nList\u003cNode\u003e nodes;\n\n// Traverse function returns if traversable or not\nbool traversable = nodes = route.Traverse(graph, destination, out nodes);\nfor(int i = 0, n = nodes.Count - 1; i \u003c n; i++)\n{\n    var from = nodes[i];\n    var to = nodes[i + 1];\n\n    // draw line between from and to nodes\n    Gizmos.DrawLine(from.Position, to.Position);\n}\n\n```\n\n## PathRenderer\n\n## Sources\n\n- Dijkstra's algorithm - Wikipedia - https://en.wikipedia.org/wiki/Dijkstra's_algorithm\n- Priority Queue implementation from Microsoft/MixedRealityToolkit-Unity - https://github.com/Microsoft/MixedRealityToolkit-Unity\n","funding_links":[],"categories":["C\\#","Open Source Repositories","Open Source Packages"],"sub_categories":["AI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattatz%2Funity-path-finding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattatz%2Funity-path-finding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattatz%2Funity-path-finding/lists"}