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
1
Question by bonzo_ · May 16, 2018 at 08:11 PM · androidlicenseuserend

Add EULA to Unity Project for Android/iOS

So like I said in the title, I'm at the stage where I need to add a EULA to the mobile app I'm developing. I can't find anywhere where to create one in a Unity project, or if it has to be custom made and if so, how to even do that.


I thought at first to just add a new scene with the EULA text and buttons that either close or go further into the app, but I don't know how to make that appear only on the very first time the app is ever opened on a device.


If there is a resource/feature in Unity that already exists to do this I would greatly appreciate it if could be pointed out to me. For reference, I am using Unity 2017.3.0f3.

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

3 Replies

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

Answer by bonzo_ · May 17, 2018 at 07:24 PM

So for the sake of my own needs, I have created a solution that I am (at the moment) satisfied with. For documentation I'm posting it as an answer here and will outline what I did in C# and Unity.
In Unity I created a panel that contains everything involved the EULA GUI. This panel will be turned off .SetActive(false) once the 'Accept' button is pressed.

From here I created a script 'EULAScript.cs' that is attached to the canvas of the scene.

 private int ViewEULA;
 
     void Start () {
         EULAStatus();
     }
 
     public GameObject EULABox;
     private void EULAStatus()
     {
         if (PlayerPrefs.GetInt("ViewEULA") == 1)
         {
             Debug.Log("EULA has been accepted");
             EULABox.SetActive(false);
         }
         else if (PlayerPrefs.GetInt("ViewEULA") == 0)
         {
             Debug.Log("Int set to 0");
             EULABox.SetActive(true);
         }
         else
         {
             Debug.Log("Really I should just have it just end in an else but you get the idea");
         }
     }
 
     public void AcceptEULA()//Accept button
     {
         PlayerPrefs.SetInt("ViewEULA", 1);
         EULAStatus();
         Debug.Log("Accepted");
     }
 
     public void DeclineEULA()//Decline button
     {
         Application.Quit();
     }
 

This differs from my commend above, as I moved the if/else logic out of the OnGUI() and into a private class that is then called only when one of the buttons is pressed. I used integers rather than a bool for this because I was having a little trouble handling a PlayerPrefs.SetInt("ViewEULA", true); so I just used a 1 and 0 instead. The EULAStatus()' runs in the start, which when attached to the canvas, runs each time the app loads up. So for my application, selecting decline would have the app close. I moved the Application.Quit();` into the Decline button, because having it run when the PlayerPrefs is set to 0, the app gets stuck in a loop of constantly quitting the moment it loads in. Take it as my style coupled with my inexperience as to why/how I'm doing it this way. I'd still love if a more experienced person (that's setting the bar real low tbh) could come by for myself and future developers and give a better answer to this.

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 Hoorza · May 17, 2018 at 07:45 AM

There is no future like this in Unity although it would be very nice. I am also interested in that topic for the future projects but so far I have only seen 3rd party companies that make them for you. And it is not the cheapest. I think finding very generic is a bad idea as it will only full you into thinking that you are covered and doing a good thing, but if something goes wrong you will find out that your T&Cs or EULA are flawed and do not serve the purpose. We are not lawyers so it is difficult to know what is required. Also, GDPR is coming into force on the 25 of May 2018 and that may make things easier as it will be a hot topic so people might make some tutorials. I will post more if I find something. Here is a 3rd party website that does this service:

  • TermsFeed.com this paid one,

  • EulaTemplate.com and this one seems to be free, not tested.

    -

If you use them please share your experience here for others to read.

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 bonzo_ · May 17, 2018 at 04:46 PM 0
Share

I think you might be misunderstanding my question. I don't need text for the EULA, we are beyond completely covered trust me.

What I'm looking for is code for properly handling the accept/decline buttons for the EULA. When the app is loaded in for the very first time on a device, the EULA appears, and every time after that very first time opened (assu$$anonymous$$g the user select 'Accept') the EULA never appears unless uninstalled and reinstalled.

I did find a solution, but I am not too happy with it.

 public GameObject EULABox;
 public int ViewEULA;
 
 void OnGUI(){
     if(PlayerPrefs.GetInt("ViewEULA") == 1){
         EULABox.SetActive(false);
         Debug.Log("EULA has been accepted");
     }
     else if (PlayerPrefs.GetInt("ViewEULA") == 1){
         Application.Quit();
         Debug.Log("EULA has been declined");
     }
 }
 
 public void AcceptEULA(){
     //THIS IS THE ACCEPT BUTTON
     PlayerPrefs.SetInt("ViewEULA", 1);
 }
 
 public void Decline(){
     //THIS IS THE DECLINE BUTTON
     PlayerPrefs.SetInt("ViewEULA", 0);
 }


$$anonymous$$y issue with this is that this will always be running, and I see the debug logs like "EULA has been declined" in the console building up to the thousands in just a couple of seconds.

avatar image Hoorza · May 17, 2018 at 07:32 PM 0
Share

Ohh my bad. Now I understand ( I hope*:p ). Well if you don't want it to be called constantly do not use OnGUI() function. This is from Unity manual:"OnGUI is called for rendering and handling GUI events."*. So it will be called every frame. Place the same code in the Start function and it will be called once every time the player starts the game until he accepts the EULA. - You can use Scroll Rect (ScrollRect) UI element to put all of the text inside with two buttons below: "RE$$anonymous$$IND $$anonymous$$E LATER" and "ACCEPT".

Hope I understood you now :)

avatar image
0

Answer by KVinS · Jun 19, 2018 at 09:14 PM

Well ... This is almost the solution... At first, I thought I could use:

 System.Globalization.RegionInfo.CurrentRegion

But it turned out that he always displays the "US". Then I found this plugin: https://assetstore.unity.com/packages/tools/integration/precise-locale-65836 There libraries for native platforms are used.

 PreciseLocale.GetRegion()

It is necessary to compare the received region with:

 "BE", "EL", "LT", "PT", "BG", "ES", "LU", "RO", "CZ", "FR", "HU", "SI", "DK", "HR", "MT", "SK", "DE", "IT", "NL", "FI", "EE", "CY", "AT", "SE", "IE", "LV", "PL", "UK", "CH", "NO", "IS", "LI" 

Then it remains only to copy the text from the Google's example: https://developers.google.com/admob/android/eu-consent and write the code for "npa".

 AdRequest request = new AdRequest.Builder()  .AddExtra("npa", "1")  .Build();

(Sending a value of "1" will serve non-personalized ads)

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

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

Create Keystore 5 Answers

Unity Free and Mobile Platforms 1 Answer

Does the personal version include build to android? I keep getting the message "Your license does not cover Android Publishing". If not which tier do I have to purchase to get this? 3 Answers

Mixing free with free + basic android license 0 Answers

unable to run keytool 2 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