The global function.

Is it possible to use one function at all stages/scenes?

I’d like to do, player looking for, for example: cube, and at the end of the game counted to how much a player has collected. I know it can be done if I have one scene but if there are many more?

Attach a script to a game object and use DontDestroyOnLoad so it’s not removed when you change scenes.