Filing a preliminary notice isn't necessarily required, but serving a preliminary notice is typically a prerequisite to filing a mechanics lien in California.
Generally, all parties who didn't contract directly with the property owner are required to send a 20-day Preliminary Notice in order to secure lien rights in California. However, if the project has a lender, then direct contractors (such as GCs) are required to send notice to the lender. Late notice is still effective, but will only secure lien rights for the value of labor and/or materials provided in the 20 days preceding the notice and everything thereafter.
Here are some resources you may find helpful: