restricting player movement with a path?

hi,
I’m working on a 3d sidescroller. The Player should be walking on the x- and y-Axis, scripting it is no problem (but I’m not an expert). The Terrain is in 3d, so lets say the player is moving forward, but is restricted to path: when the path is going into the Z-axis, the player will move along.
I thought using this tutorial to create a path link:path tutorial
and than attaching the player to it. Is this the right way?

Basically you can restrict movement with colliders aligned with the Z Axis. One to front and another to the back. By this approach you can define the free movement area inside editor.