How to make 2D multiple waypoints for sidescroller shooter or some other similiar movement

I’m making 2D Space SideScroller shooter, and I want to my enemies to have waypoints to move, or just some preset zig-zag routes. I’d like to hear as much as possible ways to do this, so far the ones I’ve found online in Unity answers haven’t really worked for me.

Here’s a similar example of what I want it to look like.

Also, I prefer C#, though in worst cases I guess I can translate it over from JavaScript

Thank you for your help! :slight_smile:

From the video, it seems to be some kind of Sin wave. Attach something like this to the enemy:

public float xPos = 0f;
public float speed = 5f;
public float waveHeight = 5;

void Update(){

	// Calculate y position
	float yPos = Mathf.Sin(Time.time * speed) * waveHeight / 6;

	// X Position is just increasing over time
	xPos += Time.deltaTime;

	// Physically move the position
	transform.position = new Vector3(xPos, yPos, 0);