Justin Theroux was shocked about the amount of attention he received when he started dating Jennifer Aniston in 2011. But advice from longtime pal Jason Bateman got him through the hard times of living in the spotlight.

The actor, 49, joined Willie Geist on “Sunday Today With Willie Geist” to promote his new Apple+ TV show “The Mosquito Coast” and in a new preview for the interview, he opened up about his now ex-wife Aniston and why Bateman’s advice meant so much.

“Was that a shock to your system though? Ten years ago when you started dating Jennifer and got married all that attention that you got?” Geist asked.

RELATED: Justin Theroux Talks Following In Harrison Ford’s Footsteps In New Adaptation Of ‘The Mosquito Coast’

“Yeah, I think part of me was like, you know, I’m essentially sort of a character actor and a writer, there’s not much there,” “The Leftovers” star explained. “Jason Bateman actually once gave me one of the most sage pieces of advice ever when all that was kind of going on.”

He continued, “And he said, ‘Look, in that side of the entertainment industry, a character is about to be born and that character is you, but it’s not you. That character is, you know, angry, that character has got a problem, that character is, you know, sweet. It’s just this little soap opera that gets written in the margins.’ And he said, ‘And so my advice is, don’t follow that guy’s storyline.'”

Adding, “And it was a good piece of advice because I stuck to it. And that’s the only way you can sort of keep sane and all that.”

RELATED: Justin Theroux Gushes Over Ex-Wife Jennifer Aniston: ‘We Love Each Other’

But despite their split in 2017, Theroux says he and the “Friends” icon, 52, remain close.

Earlier this month, Theroux told Esquire mag, “We FaceTime. We text. Like it or not, we didn’t have that dramatic split, and we love each other.”

He added, “I’m sincere when I say that I cherish our friendship.”

Theroux and Aniston tied the knot in 2015 and divorced two years later.

The full interview with Theroux airs Sunday.