How do I update a prefab through code C#

I want to make stats for my character, and I want to make sure these stats don’t reset every time you change a scene. How do I update the prefab through code so every time I increase the int the prefab will update?

You cannot update your prefab at runtime. However, you can create a persistent object in your scene(s) with:

DontDestroyOnLoad(transform.gameObject);.

This object will stay in your scenes even when you load a new one. You can set and update your stats there.