Have you ever had a dream but realized that you knew was just a dream even though you are still sleeping.
--- I think it should be "were" not "are"?
Should I put a comma before "but"?
emsr2d2 would have put a comma in had it been necessary.
But I understand that it's not necessary in this case? However sometimes (or maybe pretty often) we put a comma before "but" in English?
We do sometimes. Click here to read earlier answers to this question.
I found these by typing Comma before 'but' in the Google Custom Search box at the top of the page.