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 Yoconn · Sep 27, 2017 at 11:36 PM · onceleveling

Any good ideas on how to implement a one time reward system?

So I have if statements that represent your level for example

if (xp >= 100) { display.text = " Level 5 Novice"; }

I need it to show up at the end of the match if it adds up past the level for the first time and save that you have received it, also if you happen to level up twice have it give you both? Any good ways for this? (could also completely scratch my level display system doesn't matter I just did it this way since it works)

Thanks <33

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 Slimboy_90 · Sep 28, 2017 at 12:08 AM 0
Share

Why dont you simply use a bool like this:

 if(xp>=100 && alreadyLevelUp != true) ..//do stuff, set alreadyLevelUp = true

Of course you would still have to check which level the player actually is, in order to know which level he reached.

1 Reply

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

Answer by haruna9x · Sep 28, 2017 at 12:55 AM

If you only look at the player's xp. It's easy to do it as a high score. Use highXP to see if the player has passed it.

Comment
Add comment · Show 3 · 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 Yoconn · Sep 28, 2017 at 01:19 AM 0
Share

Could you elaborate a little more I'm not quite sure what you mean. If I use highXP to see if the player has passed it wouldnt it just reward it every time it checks?

avatar image haruna9x Yoconn · Sep 28, 2017 at 01:28 AM 0
Share
 private int xp;
         private int highXP;  // need save it
 
         public int Xp
         {
             get { return xp; }
             set
             {
                 xp = value;
                 if (xp > highXP)
                 {
                     highXP = xp;
                    CheckBonus();
                 }
             }
         }
 
         void CheckBonus()
         {
         // check
             if (highXP > 100)
                 Debug.Log("Bonus at: " + 100);
         }
 
 
         // Save load
 
         void OnAwake()
         {
             highXP = PlayerPrefs.GetInt("HighXP", 0);
         }
 
         void OnDestroy()
         {
             PlayerPrefs.SetInt("HighXP", highXP);
         }
avatar image Yoconn · Sep 28, 2017 at 01:41 AM 0
Share

Ohhh thats what you meant. Thanks haruna <333

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

70 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

Related Questions

Using the head look controller as a method to keep ship level with ground. 1 Answer

Calling a function only once whenever conditions are correct 1 Answer

Is it possible to have multiple scenes saved in memory? 1 Answer

coroutine spamming webserver which then stops replying 2 Answers

StartCoroutine works once 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