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"?
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.
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?