My latest update to my space shooter game is an enemy that has random movement. This was rather a simple thing to implement and the code below pretty much explains it all.
The ZigzagEnemy method is on my Enemy script and takes a float variable that is a random number between 0–100 that is changed in the coroutine every second. This random number will determine if the enemy moves down, left, or right. One thing I learned is to be careful when calling a random number on update because it might not behave how you would expect.
Here is what they look like!