How to run multiple scene of unity just once during the launching of app










1














I want to know how to make something happen only once like a tutorial in a game which appears only when you first start your game and then when your game got saved to a further point it never appears again even when you close your game and start again.



Basically, I have seven scenes but I want to play scene 1-5 just one on the launching of the app and then next time when the user opens the app it directly jumps to the 6th scene



So I want to know how to make something happen only once in a game application.



I hope you get my point.










share|improve this question


























    1














    I want to know how to make something happen only once like a tutorial in a game which appears only when you first start your game and then when your game got saved to a further point it never appears again even when you close your game and start again.



    Basically, I have seven scenes but I want to play scene 1-5 just one on the launching of the app and then next time when the user opens the app it directly jumps to the 6th scene



    So I want to know how to make something happen only once in a game application.



    I hope you get my point.










    share|improve this question
























      1












      1








      1







      I want to know how to make something happen only once like a tutorial in a game which appears only when you first start your game and then when your game got saved to a further point it never appears again even when you close your game and start again.



      Basically, I have seven scenes but I want to play scene 1-5 just one on the launching of the app and then next time when the user opens the app it directly jumps to the 6th scene



      So I want to know how to make something happen only once in a game application.



      I hope you get my point.










      share|improve this question













      I want to know how to make something happen only once like a tutorial in a game which appears only when you first start your game and then when your game got saved to a further point it never appears again even when you close your game and start again.



      Basically, I have seven scenes but I want to play scene 1-5 just one on the launching of the app and then next time when the user opens the app it directly jumps to the 6th scene



      So I want to know how to make something happen only once in a game application.



      I hope you get my point.







      unity3d unityscript






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 11:31









      Simran Munot

      62




      62






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You could have a look at using PlayerPrefs. There are multiple ways of using them but this could be one lightweight solution for you.



          An example of how to use them would be like this for you;



          private void Awake()

          int tutorialFinishedFlag = PlayerPrefs.GetInt("TutorialFinished", 0);

          if(tutorialFinishedFlag == 0)

          ShowScenesOneToFive();

          else

          ShowSceneSix();




          And when you've finished showing them the first 5 scenes, you can set the PlayerPref like so;



          PlayerPrefs.SetInt("TutorialFinished", 1);





          share|improve this answer




























            1














            Well, this issue can be easily addressed using PlayerPrefs. You can call PlayerPrefs.SetInt() and PlayerPrefs.GetInt(). Like so:



            public class SceneRouting : MonoBehaviour 
            void Awake()
            // -1 means it is not the first time the player launches the game
            // while 1 means it is the first time the player launches the game
            int isFirstTime = PlayerPrefs.GetInt("isFirstTime", -1);

            if(isFirstTime > 0)
            // Here you can load any of these scenes 1, 2, 3, 4, 5
            else
            // Here you can load scene 6





            You can set the isFirstTime variable anywhere in your game flow. Say, for example, when you call the Foo() method, you don't want the game to load scenes 1-5 next time it launches:



            public void Foo()
            PlayerPrefs.SetInt("isFirstTime", -1);



            Additionally, if you want your game to load scene 6 upon launch, you can set the isFirstTime value to 1






            share|improve this answer




















            • Could you elaborate more please
              – Simran Munot
              Nov 16 at 18:06










            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261264%2fhow-to-run-multiple-scene-of-unity-just-once-during-the-launching-of-app%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You could have a look at using PlayerPrefs. There are multiple ways of using them but this could be one lightweight solution for you.



            An example of how to use them would be like this for you;



            private void Awake()

            int tutorialFinishedFlag = PlayerPrefs.GetInt("TutorialFinished", 0);

            if(tutorialFinishedFlag == 0)

            ShowScenesOneToFive();

            else

            ShowSceneSix();




            And when you've finished showing them the first 5 scenes, you can set the PlayerPref like so;



            PlayerPrefs.SetInt("TutorialFinished", 1);





            share|improve this answer

























              1














              You could have a look at using PlayerPrefs. There are multiple ways of using them but this could be one lightweight solution for you.



              An example of how to use them would be like this for you;



              private void Awake()

              int tutorialFinishedFlag = PlayerPrefs.GetInt("TutorialFinished", 0);

              if(tutorialFinishedFlag == 0)

              ShowScenesOneToFive();

              else

              ShowSceneSix();




              And when you've finished showing them the first 5 scenes, you can set the PlayerPref like so;



              PlayerPrefs.SetInt("TutorialFinished", 1);





              share|improve this answer























                1












                1








                1






                You could have a look at using PlayerPrefs. There are multiple ways of using them but this could be one lightweight solution for you.



                An example of how to use them would be like this for you;



                private void Awake()

                int tutorialFinishedFlag = PlayerPrefs.GetInt("TutorialFinished", 0);

                if(tutorialFinishedFlag == 0)

                ShowScenesOneToFive();

                else

                ShowSceneSix();




                And when you've finished showing them the first 5 scenes, you can set the PlayerPref like so;



                PlayerPrefs.SetInt("TutorialFinished", 1);





                share|improve this answer












                You could have a look at using PlayerPrefs. There are multiple ways of using them but this could be one lightweight solution for you.



                An example of how to use them would be like this for you;



                private void Awake()

                int tutorialFinishedFlag = PlayerPrefs.GetInt("TutorialFinished", 0);

                if(tutorialFinishedFlag == 0)

                ShowScenesOneToFive();

                else

                ShowSceneSix();




                And when you've finished showing them the first 5 scenes, you can set the PlayerPref like so;



                PlayerPrefs.SetInt("TutorialFinished", 1);






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 12 at 11:51









                Ryan Singh

                1,17131331




                1,17131331























                    1














                    Well, this issue can be easily addressed using PlayerPrefs. You can call PlayerPrefs.SetInt() and PlayerPrefs.GetInt(). Like so:



                    public class SceneRouting : MonoBehaviour 
                    void Awake()
                    // -1 means it is not the first time the player launches the game
                    // while 1 means it is the first time the player launches the game
                    int isFirstTime = PlayerPrefs.GetInt("isFirstTime", -1);

                    if(isFirstTime > 0)
                    // Here you can load any of these scenes 1, 2, 3, 4, 5
                    else
                    // Here you can load scene 6





                    You can set the isFirstTime variable anywhere in your game flow. Say, for example, when you call the Foo() method, you don't want the game to load scenes 1-5 next time it launches:



                    public void Foo()
                    PlayerPrefs.SetInt("isFirstTime", -1);



                    Additionally, if you want your game to load scene 6 upon launch, you can set the isFirstTime value to 1






                    share|improve this answer




















                    • Could you elaborate more please
                      – Simran Munot
                      Nov 16 at 18:06















                    1














                    Well, this issue can be easily addressed using PlayerPrefs. You can call PlayerPrefs.SetInt() and PlayerPrefs.GetInt(). Like so:



                    public class SceneRouting : MonoBehaviour 
                    void Awake()
                    // -1 means it is not the first time the player launches the game
                    // while 1 means it is the first time the player launches the game
                    int isFirstTime = PlayerPrefs.GetInt("isFirstTime", -1);

                    if(isFirstTime > 0)
                    // Here you can load any of these scenes 1, 2, 3, 4, 5
                    else
                    // Here you can load scene 6





                    You can set the isFirstTime variable anywhere in your game flow. Say, for example, when you call the Foo() method, you don't want the game to load scenes 1-5 next time it launches:



                    public void Foo()
                    PlayerPrefs.SetInt("isFirstTime", -1);



                    Additionally, if you want your game to load scene 6 upon launch, you can set the isFirstTime value to 1






                    share|improve this answer




















                    • Could you elaborate more please
                      – Simran Munot
                      Nov 16 at 18:06













                    1












                    1








                    1






                    Well, this issue can be easily addressed using PlayerPrefs. You can call PlayerPrefs.SetInt() and PlayerPrefs.GetInt(). Like so:



                    public class SceneRouting : MonoBehaviour 
                    void Awake()
                    // -1 means it is not the first time the player launches the game
                    // while 1 means it is the first time the player launches the game
                    int isFirstTime = PlayerPrefs.GetInt("isFirstTime", -1);

                    if(isFirstTime > 0)
                    // Here you can load any of these scenes 1, 2, 3, 4, 5
                    else
                    // Here you can load scene 6





                    You can set the isFirstTime variable anywhere in your game flow. Say, for example, when you call the Foo() method, you don't want the game to load scenes 1-5 next time it launches:



                    public void Foo()
                    PlayerPrefs.SetInt("isFirstTime", -1);



                    Additionally, if you want your game to load scene 6 upon launch, you can set the isFirstTime value to 1






                    share|improve this answer












                    Well, this issue can be easily addressed using PlayerPrefs. You can call PlayerPrefs.SetInt() and PlayerPrefs.GetInt(). Like so:



                    public class SceneRouting : MonoBehaviour 
                    void Awake()
                    // -1 means it is not the first time the player launches the game
                    // while 1 means it is the first time the player launches the game
                    int isFirstTime = PlayerPrefs.GetInt("isFirstTime", -1);

                    if(isFirstTime > 0)
                    // Here you can load any of these scenes 1, 2, 3, 4, 5
                    else
                    // Here you can load scene 6





                    You can set the isFirstTime variable anywhere in your game flow. Say, for example, when you call the Foo() method, you don't want the game to load scenes 1-5 next time it launches:



                    public void Foo()
                    PlayerPrefs.SetInt("isFirstTime", -1);



                    Additionally, if you want your game to load scene 6 upon launch, you can set the isFirstTime value to 1







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 12 at 12:08









                    stamblew

                    517




                    517











                    • Could you elaborate more please
                      – Simran Munot
                      Nov 16 at 18:06
















                    • Could you elaborate more please
                      – Simran Munot
                      Nov 16 at 18:06















                    Could you elaborate more please
                    – Simran Munot
                    Nov 16 at 18:06




                    Could you elaborate more please
                    – Simran Munot
                    Nov 16 at 18:06

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261264%2fhow-to-run-multiple-scene-of-unity-just-once-during-the-launching-of-app%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    政党

                    天津地下鉄3号線