I was never happy with simply rotating a particle field for galaxies, it just makes it look like a rigid body and not a flow of stars. This galaxy generator uses the density wave theory to create and animate the motion of stars in the galaxy. This theory
Interested in the maths? Go to the Density Wave Theory on Wikipedia
And a very good explanation on how to practically apply the theory to visualize it.
I’ve translated the C++ implementation found here http://beltoforion.de/article.php?a=spiral_galaxy_renderer to C# and got it to run in Unity.