A Unity package that allows you to create and manipulate paths for game objects to follow. This tool is simple to use, customizable, and supports baking paths for improved performance.
- Open Unity and go to the Package Manager window.
- Press the
+button in the top left corner. - Choose "Add package from Git URL..."
- Paste the following URL:
https://github.com/romifauzi/PathTools.git?path=/Assets/PathTools - The package will be added to your project. You can also check the included samples for example scenes and usage.
- Add the Path Script:
- Add the
PathScriptcomponent to any GameObject. - Start adding nodes to create your path, then move and adjust the nodes and their handles as needed.
- Make an Object Follow the Path:
- Add the
MoveAlongPathcomponent to any GameObject that you want to move along the path. - Assign the GameObject with the
PathScriptcomponent to thepathfield in theMoveAlongPathcomponent. - Adjust properties in
MoveAlongPathsuch as speed, looping, etc., to suit your needs. - Done! Your GameObject will now follow the path.
Baking the path can improve performance by precomputing the path data.
- Add the BakedPath Component:
- Add the
BakedPathcomponent to a different GameObject (separate from the one withPathScript).
- Bake the Path:
- In the inspector of the GameObject with the
PathScriptcomponent, drag the GameObject with theBakedPathcomponent to the "Baked Path" field. - Press the BAKE button.
Now, the MoveAlongPath component can use the baked path for better performance by assigning the BakedPath GameObject.
If you want to customize or create your own path-following behavior, feel free to explore the MoveAlongPath script. It offers a straightforward way to work with the PathBase object, and you should be able to easily adapt it to fit your own requirements.
Enjoy using Path Tools to create smooth and dynamic paths in your Unity projects and please report any bug, Thanks!
