By self re-evaluation for a few years with very minimal interactions with others. I wouldn't recommend it but it worked for me, given I had to detach completely from my religion in the way how my society was functioning in regard to it. But I cannot stress how well it shaped me from a morality perspective and pretty thankful for that. Im very morally straight, I've never hurt anyone or any entity no matter its size(beside mosquitoes and cockroaches)
Three.
First was when i was 19, I took a year off after highschool and went to a new town to study and accumule as much knowledge on physics, until one day when my roommate brought some hump, i took some of it as I was about to watch "the social network" and made me switch from physics to spending the rest of the year learning c++, and eventually getting an engineering degree on systems informations.
Second and third was when I came to the realisation that i had to temporarily stop my studies and go back home, because my mental health and psyche was deteriorating, which in turn was affecting my whole life and grades. After a few months I realised that my religion was the source of my misery because i was following it as it was meant to be followed, but the environment(which is "99% religious") wasn't comforming to its values. And the fact that my religion defined my identity, I found myself in an "interesting" position where I had to reshape my identity from scratch.
I was heavily tied to my religion since I was a child, and I'd reason almost all things in life in contrast to it, especially from a scientific stand-point, to make it look and sound legit to my perspective as much as I could, I was very faithful, but still kept it in moderation.
When it suddenly clicked to me that maybe I was just deluding myself my whole life, and that was a few months after I went to my hometown from the big city I used to live in and study after the implosion I undergone through, I found myself heavily tied to so many ideologies I no longer wanted to be tied to, and I basically had to think of how I'd reconstruct my identity from the ground up.
I started dropping my beliefs bits by bits, and re-evaluated my view of a lot of things I used to be against/for. On another hand, I also went into a complete hiatus, confining myself from the environment I was living in. I did cut my ties to everyone I used to know, and got into an escapism whirlpool for a few years while being as minimalistically hedonistic as I can as long as I don't get to affect or hurt anyone by it(I basically went into lazy mode, but I didn't want to put any burden of guilt on myself for that period of time).
Since past year or so, I got out of that escapism loop, started getting social again, but I'm also pretty cautious in term who I want to spend my time with, especially since I did "waste"(I don't regret it) a good amount of it when I was keeping it to myself for that period of time.
The implosion I had did made me rethink so many things in life, and I'm very thankful it did happens nonetheless.