First, note that simply having a sexually oriented conversation with a minor via text messages is not illegal. Exactly what was said would matter. If the character in your book sent to a minor in California material that is considered pornographic, he’d be at risk of prosecution for distribution of “harmful matter” to a minor under California Penal Code (PC) section 313.1. The punishment for that is a fine of up to $2,000 and/or up to one year in the county jail for a first offense. For that offense, PC § 802(a) provides the basic rule of limitation:
802. (a) Except as provided in subdivision (b), (c ), (d), or (e), prosecution for an offense not punishable by death or imprisonment in the state prison or pursuant to subdivision (h) of Section 1170 shall be commenced within one year after commission of the offense.
Because this is a crime that is not punishable by death or imprisonment in the state prison (instead, imprisonment is in the county jail) and subdivisions (b) through (e) do not address this offense, the time limitation for this offense is one year from the commission of the offense.
Note that if the defendant had previously been convicted of any other offense related to production of obsence or harmful matter, the situation changes because he is subject to punishment under PC § 1170(h). The sentence imposed under that section can result in up to 3 years in county jail. And, importantly for the statute of limitations purposes, the relevant statute of limitiation is now PC § 801:
801. Except as provided in Sections 799 and 800, prosecution for an offense punishable by imprisonment in the state prison or pursuant to subdivision (h) of Section 1170 shall be commenced within three years after commission of the offense.
So, in that case, the initial limitation period is three years from the date of the offense rather than one.
Note that in either case, if the defendant is out of the state when the crime is committed or thereafter, the time for prosecution is extended by the time the defendant is out of the state, up to a maximum 3 year extension under PC § 803(d).
If the idea is that the messages might provide evidence that he had engaged in some type of sexual activity with a minor, that is of course much more serious, the limitations period for those crimes will be longer.