Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 zcoldrick · Mar 06, 2014 at 07:38 PM · demo

Limit number of run/executions

Is it possible to limit the number of times a game can be run? The equivalent of producing a full working demo but it expires after say 30 goes?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by fafase · Mar 06, 2014 at 07:46 PM

On your first scene, add a script that runs something like this:

 private int counter;
 void Awake()
 {
      counter = PlayerPrefs.GetInt("Counter");
      if(counter> 29)
      {
           Application.Quit();
      }
      else{
           PlayerPrefs.SetInt("Counter", counter);
      }
      counter++;
 }

For better control, you should store the information on a server but this s just for you to get the idea.

Also this solution is a little abrupt since it closes like this, pouf. You may want to warn the user.

Comment
Add comment · Show 6 · 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 zcoldrick · Mar 08, 2014 at 09:11 PM 0
Share

Does the private int counter really not reset to null every time the program is restarted ?

avatar image Jamora · Mar 08, 2014 at 09:14 PM 1
Share

PlayerPrefs store data into the registry on windows computers, so it will remain even through computer restarts. The last line should probably say counter+1.

avatar image zcoldrick · Mar 08, 2014 at 09:15 PM 0
Share

Is that value encrypted or could it be accessed and changed with a text editor ?

avatar image zcoldrick · Mar 08, 2014 at 09:17 PM 0
Share

Also is it linked to the program by its name? Could the 30 execution expiry be circumvented by just changing the name of the program ?

avatar image fafase · Mar 09, 2014 at 11:28 AM 1
Share

I added the missing counter++, concerning the hack well there are ways to fix it until someone breaks it. One other way is to store in db with a login but then the user can create multiple logins. So I would think the time you will spend trying to find they ultimate way is not worth the result. $$anonymous$$any games comes with restrictions, like waiting for regeneration but simply changing the time on your device and you hack the game. Still they don't try and fix it.

Show more comments

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

21 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

Related Questions

Lerpz Demo Just Falls From the Sky 2 Answers

How do I share my Unity Demo? 1 Answer

Unity game with license check through the LVL and the Android Market client 3 Answers

Auto decal mesh creator in the boot camp demo scene? 2 Answers

Demo Project: Looking for free demo project that uses C# 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