Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ZenBubblez · Mar 30, 2018 at 08:11 PM · tutorial

How to make my tutorial appear only once?

I don't think it's possible with unity, but I'd like my little tutorial to show once on the first play, & never show again when the player plays the game for the second time & so on.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TreyH · Mar 30, 2018 at 08:17 PM 0
Share

Saying "I don't think it's possible with Unity" is essentially saying "I have a problem that Unity has never considered and that the entire C# language cannot solve". It's possible and it's simple to implement 100 different ways, but the Unity-specific solution might be to just use PlayerPrefs.

https://docs.unity3d.com/ScriptReference/PlayerPrefs.html

avatar image Razputin · Mar 30, 2018 at 11:04 PM 0
Share
 If(PlayerPrefs.GetInt("FirstTime") == 0)
 {
 //Load tutorial
 }
 else
 {
 //load something different
 }

Just set do PlayerPrefs.SetInt("FirstTime") == 1 when the player finishes the tutroial.

4 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by RyanAtEvno · Mar 30, 2018 at 08:52 PM

Basically in start function PlayerPref.SetInt ("TutorialHasPlayed", 0); Then for your tutorial start put if (PlayerPref.GetInt ("TutorialHasPlayed", 0) <= 0) {//--start tutorial--//; PlayerPref.SetInt ("TutorialHasPlayed", 1); }. This will set the playerpref int with 0 as false and 1 as true. Once the tutorial plays It will set the int to 1 as true and it will no longer play on that device.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ZenBubblez · Apr 05, 2018 at 08:20 PM 0
Share

Thank you! This is sure to help my game appear better, as well as make a somewhat advanced tutorial system.

avatar image faizanahmed089 · Apr 28 at 01:36 PM 0
Share

Thank you so much @RyanAtEvno Its help me alot

avatar image
1

Answer by Razputin · Mar 30, 2018 at 11:05 PM

  If(PlayerPrefs.GetInt("FirstTime") == 0)
  {
  //Load tutorial
  }
  else
  {
  //load something different
  }

Just do PlayerPrefs.SetInt("FirstTime",1) when the player finishes the tutorial.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Rygaran · Mar 30, 2018 at 08:19 PM

you can make your tutorials dependant on a bool, that after first play gets set to false. you could store it in playerprefs, and even make it a setting in a menu.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RyanAtEvno · Mar 30, 2018 at 08:53 PM 0
Share

except you can't set a bool in playerpref

avatar image
0

Answer by A3miz · Feb 22, 2021 at 01:49 PM

 using System;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 
 public class GameLaunchCounter : MonoBehaviour
 {
     string SessionNumber = PlayerPrefs.GetString("unity.player_session_count");
     
     private void Start()
     {
         if (SessionNumber == "0")
         {
             SceneManager.LoadScene("Tutorial");
 
             else
             {
                 SceneManager.LoadScene("SomethingElse")
             }
 
         }
     }
 }
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JuniorMaphosa · May 07, 2021 at 10:25 AM 0
Share

Here's a better ready script if needed. No errors expected.

using System; using UnityEngine; using UnityEngine.SceneManagement; public class TutorialScript : MonoBehaviour { private void Start() { string SessionNumber = PlayerPrefs.GetString("unity.player_session_count"); if (SessionNumber == "0") { SceneManager.LoadScene("Tutorial"); } else { SceneManager.LoadScene("MainMenu"); } } }

avatar image Youssef-xD JuniorMaphosa · Jun 22, 2021 at 03:04 PM 0
Share

I don't think this could work, because the player can enter the game and exit before completing the tutorial, and that would make the unity.player_session_count > 0 but the player didn't do the tutorial

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

87 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how do i make a level map like super mario 3 1 Answer

Side battle tutorial using 3d objects 0 Answers

Enemy AI script trouble(Js to c#) 3 Answers

Stealth project: lightmapping artifacts 1 Answer

Why is the boundary not working? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges