It’s not just the notes… potentially more important is the rhythm or groove. And you will need to work that out together with the other band members, in particular the drummer!
I tend to work out groove elements first (while sticking to roots/fifths) before expanding or developing the bass line more harmonically.
Even if it’s just root notes, I try to get a groove down and especially focus on when NOT to play.
Has to serve the song etc.
But I’m finding that there are places where I need to fill in that space because the guitar is doing something more subtle, or creating soundscapes etc.
I had to come up with a few bass lines and I had fun doing it. I probably recorded 50-70 originals. Most started with root notes and some fills ideas, then it turned into some grooves.
I’d recorded some demos and listened to the tape or CD in the car over and over. If something jumped out I’d hummed out the part and or put it on my personal mini cassette recorder. Inspiration can come at anytime.
Don’t worry too much most of the time on the studio version you won’t be doing a lot of fancy over the top stuff as everyone else will kick your ass especially the singer or the soloist. You save your fancy finger works when you go live.