How do scripts work across scenes?

How would you write a script for a main character’s inventory/stats/etc…?

Would you write it in the first level and link to it from the other scenes or…?

How does that work?

One simple way to handle this is to create a manager script, a singleton static script that always runs while the game runs (either attached to an object with DontDestroyOnLoad, or just a static class altogether).

From your main menu scene or somewhere you might select to load a certain level, then the manager knows what all the settings/variables/whatever for that scene(s) might be, and you would then have it somehow find all the local scripts, and set them up depending on your needs.