Boyfriend problems

Ok so Idk what to do here but I feel like my boyfriend is like clocking in and out with this whole pregnancy. I mean he is constantly at his friends house, he has started hiding things from me and gets mad when I ask, he doesn't want to be seen with me anymore and I feel like I ruined his life because this isn't what he wanted. He comes to ultrasounds and buys me what I am craving but that's it. He runs to his friends house if I tell him I'm not feeling good... Or he just flat out doesn't talk to me. I don't wanna raise this baby without him but I don't want him to think he has to do the bare minimum to stay involved. Please share advice.