How to run multiple scene of unity just once during the launching of app
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
add a comment |
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
add a comment |
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
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
unity3d unityscript
asked Nov 12 at 11:31
Simran Munot
62
62
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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);
add a comment |
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
Could you elaborate more please
– Simran Munot
Nov 16 at 18:06
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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);
add a comment |
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);
add a comment |
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);
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);
answered Nov 12 at 11:51
Ryan Singh
1,17131331
1,17131331
add a comment |
add a comment |
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
Could you elaborate more please
– Simran Munot
Nov 16 at 18:06
add a comment |
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
Could you elaborate more please
– Simran Munot
Nov 16 at 18:06
add a comment |
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
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
answered Nov 12 at 12:08
stamblew
517
517
Could you elaborate more please
– Simran Munot
Nov 16 at 18:06
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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