Yes, ds1 was like this. He was always extremely shy - from a very early age. For example, at toddler groups (and I went to several) he would sit on my knee and refuse to budge. Sometimes by the end of the session he would venture a few feet away if there was a toy which interested him, but if another child approached him he would burst into tears and run straight back to me. I used to take him to the local soft play for 9am, which was when it opened, so that if we were lucky we would get half an hour before any other children arrived - because as soon as another child came in he would run back to me and refuse to play any more. He was the same at the park - would only go on empty equipment, we never went near the park at weekends or in the school holidays. At that stage, I put it down to extreme shyness - he talked with family but no-one else. Other friends with children had never heard him speak, despite us spending a lot of time together - he was better with children he knew well, but still didn't talk/interact with them. He also had quite long periods (2/3 weeks at a time) of going into character and not speaking to anyone - not even dh and I. That was so hard. I remember his Tom Kitten phase, and his Iron Giant phase, and his C3-PO stage - it sounds funny now, but it was heartbreaking to get up each morning and spend the day with a practically silent 3 year old: being a kitten, or a robot. And he never forgot - he kept it up all day (I can't do that when I'm mad at dh, I forget I'm not talking to him!) The longest period he did that for was 3 weeks when he didn't utter a word - in the end dh and I pretty much bullied him into speaking again: we got a bin bag and started putting all his precious Star Wars toys in it - dh said we woudl take them to the tip if he didn't speak. We were desperate - it worked though - he started talking (to us at least) again.
At 3.5 he started nursery, 2 and a half days a week. He came home and regaled me with tales of what they had done and the songs they had learned. At the end of the first half term his teacher collared me and told me she was extremely concerned about him. After 7 weeks she had never heard him speak, not a single word. he made funny little squeaking noises when asked a direct question, that's all. He wouldn't make eye contact, didn't interact with the other children, hadn't eaten lunch for the whole time he was there, didn't play - just walked around on the periphery. She asked me if he could speak, and when I said (defensively I suppose) "yes - he has a fantastic vocabulary" she said "mmmm...but does he form meaningful sentences?" She then said that she suspected he might be autistic (I knew he absolutely was not) and that she wanted to start proceedings to possibly get him statemented. I didn't have MN then and to say I was utterly devastated would be an understatement. I didn't know where to turn or what to do - I knew he wasn't autistic (though his teacher was so convinced I was beginning to doubt myself over that too), but I knew something was wrong. It was a friend who first mentioned Selective Mutism - I had never heard of it - and I did some research on the internet and the stuff I read rang so many bells. I went back in to talk to his teacher about it - but I felt she wasn't taking me seriously and was still pushing for starting to assess him for statementing. My dh was utterly unsupportive - he was very sceptical of the stuff I had read on the internet and was sticking to the "he's just shy" theory.
At this stage, everything stalled because we moved house and ds1 had to start at a new pre-school. I went in before he started to talk about ds - his old pre-school sent a sealed letter () presumably to 'forewarn' them. At his first session he told them he lived in a big house and his daddy worked at the hospital - it was more than he had said to any adult apart from family since he had started to talk. I could tell the pre-school leader thought I was a seriously over-anxious parent and that his other pre-school had been worried over nothing....
It wasn't all plain sailing. He continued to be painfully shy. When he went into Reception he lapsed into Tom Kitten mode, no talking, just the odd miaow, and so when he was assessed they put him in the potential SNs group of children. Once he settled in he started talking a bit more - though "needs to speak up more / lacks confidence" has been a constant refrain at Parents' Evening for the last five years. He also found it pretty hard to make friends - much prefered his own company - but this last year he has really blossomed, grown enormously in confidence, and made some proper friends for the first time (he's 8, about to go into Year 4).
I know that was very long - and I hope it wasn't too much irrelevent waffle, I just wanted you to know that there is hope. I know how heartbreaking it can be: I used to come home and weep after toddler group, children's parties and the like.
I think jimjam's advice is excellent - seek some professional help from a clinical psychologist. I wish I'd had MN to advise me when I was so worried about ds1. I was very lucky that ds1 came out of it by himself - but I had years of worrying about him, and feeling it was all somehow my fault (I had severe PND when he was born and convinced myself it was all down to my failing to bond, continuing depression, natural shyness etc.)
Best of luck - I really feel for you.