Setup Guide
Adding PathTween to a GameObject
1. Attach the Component
- Select a GameObject in your scene
- Click Add Component in the Inspector
- Search for PathTween and select it
2. Create Waypoints
You can define waypoints inline on the component or as a reusable PathDefinition asset.
Option A: Inline Waypoints (Quick Setup)
- With the GameObject selected, go to the PathTween inspector
- Leave Path Definition empty (null)
- The inline waypoints list appears — click Add Waypoint or use the scene view
- Set each waypoint's position, rotation, scale, delay, and per-point easing override
Option B: PathDefinition Asset (Reusable)
- Right-click in the Project window → Create > SWTween > Path Definition
- Name your path asset
- Select it and set waypoints in the inspector
- Drag the asset into the Path Definition field on your PathTween component
Multiple objects can reference the same PathDefinition — edit once, update all.
3. Edit Waypoints in the Scene View
- Select a waypoint: Click its cyan sphere handle in the scene view
- Move: Drag the position handle (yellow when selected)
- Add new waypoint: Ctrl+Click on any surface — a new waypoint is created at the raycast hit point
- Delete: Select a waypoint and press Delete
For more editing tools, open Window > SWTween > Path Editor.
4. Configure Movement
| Setting | What to Choose |
|---|---|
| Mode | Once (plays once), Loop (restarts from beginning), PingPong (bounces back and forth) |
| Speed | Movement speed in world-units per second |
| Use Spline | On = smooth Catmull-Rom curves between waypoints, Off = straight line segments |
| Easing | Pick an easing curve for the movement profile (or check Use Custom Curve for a custom AnimationCurve) |
| Rotation Mode | None (keep original rotation), LookAtTarget (look at the next position ahead), FollowTangent (smooth rotation along spline direction) |
| Scale Tween | When enabled, scale interpolates between per-waypoint scale values |
| Closed | For inline paths, toggle whether the path loops back to the start |
5. Wire Up Events
The four event hooks in the inspector let you react to path progress:
| Event | Use Case |
|---|---|
| OnPathStarted | Enable particle effects, play a sound |
| OnWaypointReached(int) | Spawn an object at each waypoint, trigger a checkpoint |
| OnPathCompleted | Disable the object, trigger a game-over sequence |
| OnLoop | Increment a lap counter, change object color |
6. Control Playback
The inspector includes play/pause/stop buttons for testing:
- Play — starts movement from the beginning
- Pause — pauses at the current position
- Stop — stops and resets to the start
A progress bar shows the current normalized progress (0–100%) during playback.
You can also control the component from code:
PathTween tween = GetComponent<PathTween>();
tween.Play();
tween.JumpTo(0.5f); // jump to halfway
tween.Pause();
tween.Resume();
7. Using the Path Editor Window
Open Window > SWTween > Path Editor for the full editing toolset:
- Waypoint list — view and edit all waypoints with position fields, reorder with ^/v buttons, delete with X
- Quick Actions
- Reverse Path — flips waypoint order
- Mirror X/Y/Z — mirrors positions across the selected axis
- Scene view tools — click to select waypoints, drag position handles, Ctrl+Click to add, Delete to remove
8. Using Keyboard Shortcuts
| Action | Input |
|---|---|
| Add waypoint at surface | Ctrl + Left Click in Scene view |
| Select waypoint | Left Click on waypoint handle |
| Delete selected waypoint | Delete key |
| Move waypoint | Drag position handle |
Using the Legacy System
The original SimpleWaypointTween and SimplePathAvoidance components are preserved in the Legacy/ folder and continue to work in existing scenes.
To add them to a new GameObject:
- Click Add Component
- Search for SimpleWaypointTween (Legacy) or SimplePathAvoidance (Legacy)
The legacy components have no code dependency on the new system — they operate independently.
Dylan Auty