Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Samriel · Feb 14, 2019 at 03:35 PM · adspauseunity ads

How to add pause screen with buttons

I have recently finished the unity official youtube flappy bird tutorial. I want to give user the option that, after striking one of the columns he can watch a reward video and continue with his score. If he strikes a column again then again this screen will pop up. This screen will have two buttons - watch video or let it be game over. I dont know how to do this.

Following is my class:

 public class GameControl : MonoBehaviour
 {
     public float scrollspeed = -1.5f;
     public static GameControl instance;
     public GameObject gameOverText;
     public bool gameover = false;
     public Text scoretext;
     private int score = 0;
     void Awake()
     {
         if(instance == null)
         {
             instance = this;
         }
         else if (instance!=null)
         {
             Destroy(gameObject);
         }
     }
 
   
     void Update()
     {
         if (gameover == true && Input.GetMouseButtonDown (0))
         {
             SceneManager.LoadScene(SceneManager.GetActiveScene ().buildIndex);
         }
     }
 
     public void BirdScored()
     {
         if(gameover)
         {
             return;
         }
         score++;
         scoretext.text = "Score: " + score.ToString();
     }
 
     public void BirdDied()
     {
         gameOverText.SetActive(true);
         gameover = true;
 
     }
 }


This class takes care of the bird dying process. how can i add the option to watch add and continue the game here? Unity newbie here....

Comment
Add comment · Show 1
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 Morya108 · Jul 14, 2020 at 07:41 AM 0
Share

Have you solved this issue ? If yes, please help me for this.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by haizathaneefa · Jul 14, 2020 at 09:40 AM

The code isnt tested but it should point you to the right direction.

 public GameObject newLifeUI; // this will be your plus life UI
     public GameObject gameOverUI; // game over UI is here
 
     bool conditionChange; // checking to see if he can have a chance to continue
 
     void Start()
     {
         newLifeUI.SetActive(false);
         gameOverUI.SetActive(false);
     }
 
     void Update()
     {
         if (!conditionChange && /*have another condition here to detect if the player dies or not*/) // if the user dies the first time, let him have the chance to live again
         {
             newLifeUI.SetActive(true);
 
             conditionChange = true;
         }
 
         if (conditionChange && /*have another condition here to detect if the player dies or not*/) // tough luck
         {
             gameOverUI.SetActive(true);
         }
     }
 
     public void WatchVideo()
     {
         // your ad code will be here
     }
 
     public void QuitGame()
     {
         // quit game code will be here
     }
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

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

102 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 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

Unity Ads not working on my Android device but works on many other devices 1 Answer

IOS Ads not Displaying yet Audio Present,IOS Ads Not Displaying Yet Audio Present 0 Answers

Should I turn ads test mode overriding during the period of reviewing my game by the play store team? 0 Answers

How do I fix my error with my addlistener? 0 Answers

Unity Interstatial ad giving reward when finished? 0 Answers


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