define some global variables in the game

Hello,
If I wanna pass some variables between different scenes, what can I do??

I think I need to find a global game object which is created before any scenes are loaded. How exactly I can do it??

Thanks

afaik, PlayerPrefs are what you are looking for

For non-player pref type stuff you could also use static/singleton patterns for that purpose. Note this example is a simple static C# class, and not one inheriting from MonoBehavior.

public static class GameGlobals
{
    public static int playerScore;
}

Then inside any of your other scripts you can do things like

GameGlobals.playerScore++;

As far as persisting items between Scenes, another mechanism is DontDestroyOnLoad as explained in the API docs

Thanks guys, your posts help me a lot