Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Daily Rewards

Discussion in 'Assets and Asset Store' started by nunesbarbosa, Feb 12, 2015.

  1. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Hello everyone. Thanks for the feedback on World Clock Api. I'm looking for alternatives and I'll keep you guys posted!
     
  2. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Could you please elaborate? Do you mean where in the code this happen?
     
  3. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Ok, I have changed the API from World Clock to World Time. It should be available soon on version 1.3.2 as soon as the Asset Store approves the package. Please contact me through support with the purchase invoice if you're in an urgency so I can send you the package directly.

    After update to 1.3.2 you should change Daily Rewards World Clock settings to:
    World Clock URL: http://worldtimeapi.org/api/timezone/America/New_York
    World Clock Format: yyyy-MM-dd'T'HH:mm:ss.ffffffzzz

    World Clock should still work if they manage to fix their service. I'll probably add multiple Time servers on future updates to avoid those issues. Thanks everyone for your patience.
     
  4. mkg2w

    mkg2w

    Joined:
    Aug 19, 2013
    Posts:
    54
    Thanks for the update. Is there any way to contact the worldclock provider ? Perhaps he's unaware the service is down!

    Would you be able to share the json signature the worldclock provider returns ?
     
  5. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    World Clock API had no contact information even before the service was down.
    JSON signature should be very similar to World Time API:

    Code (JSON):
    1. {
    2.    "week_number":"10",
    3.    "utc_offset":"-05:00",
    4.    "unixtime":"1551947144",
    5.    "timezone":"America/New_York",
    6.    "dst_until":null,
    7.    "dst_from":null,
    8.    "dst":false,
    9.    "day_of_year":66,
    10.    "day_of_week":4,
    11.    "datetime":"2019-03-07T03:25:44.537595-05:00",
    12.    "abbreviation":"EST"
    13. }
    Difference should be on datetime to currentDateTime tag name and format:

    Code (JSON):
    1. "currentDateTime":"2019-03-07T03:25.537595",
     
  6. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    1.3.2 have been approved with the World Time API. A small globalization change on the URL to use EST instead of GMT-5 (New York):

    World Clock URL: http://worldtimeapi.org/api/timezone/EST
    World Clock Format: yyyy-MM-dd'T'HH:mm:ss.ffffffzzz
     
    mahmoud93p likes this.
  7. hfinn

    hfinn

    Joined:
    Oct 3, 2017
    Posts:
    5
    I am using Unity 2018.3.10.f1 and Daily Rewards 1.3.2.

    Daily Rewards works on Unity Edit.
    Daily Rewards works in Samsung Note 3 after build.
    However, it will not work on new mobile Android devices (Samsung Note 9, Galaxy 10e) after build.

    // Both have the same problem.=====================
    World Clock URL: http://worldtimeapi.org/api/timezone/America/New_York
    World Clock Format: yyyy-MM-dd'T'HH:mm:ss.ffffffzzz

    World Clock URL: http://worldtimeapi.org/api/timezone/EST
    World Clock Format: yyyy-MM-dd'T'HH:mm:ss.ffffffzzz
    =============================================

    The message of Logcat in Android studio is as follows.
    ----------------------------------------- Logcat -------- -----------------------------------
    2019-04-01 13:59:23.344 29774-29819/? E/Unity: java.io.IOException: Cleartext HTTP traffic to worldtimeapi.org not permitted

    (Filename: Line: 451)
    2019-04-01 13:59:23.397 29774-29791/? E/Unity: Error Loading World Clock. Retrying connection 1

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2019-04-01 13:59:23.400 29774-29820/? E/Unity: java.io.IOException: Cleartext HTTP traffic to worldtimeapi.org not permitted

    (Filename: Line: 451)
    2019-04-01 13:59:23.400 29774-29791/? E/Unity: Error Loading World Clock. Retrying connection 2

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2019-04-01 13:59:23.407 29774-29821/? E/Unity: java.io.IOException: Cleartext HTTP traffic to worldtimeapi.org not permitted

    (Filename: Line: 451)
    2019-04-01 13:59:23.414 29774-29791/? E/Unity: Error Loading World Clock. Retrying connection 3

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2019-04-01 13:59:23.415 29774-29791/? E/Unity: Error Loading World Clock:Unknown Error

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    ----------------------------------------- Logcat -------- -----------------------------------
     
    Last edited: Apr 1, 2019
  8. hfinn

    hfinn

    Joined:
    Oct 3, 2017
    Posts:
    5
    I looked at the discussion above.
    I followed the answer (dev_2051, Mar 5, 2019 Report # 48).
    Thank.^^ I followed the advice and the problem was solved.

    I have put the following [android: usesCleartextTraffic = "true"] in <application /> in myroid's androidmanifest.xml and it works.

    <application android: usesCleartextTraffic = "true" />
     
  9. reddo1987

    reddo1987

    Joined:
    Aug 1, 2014
    Posts:
    35
    Unity 2018.3.12

    Daily Rewards 1.3.2.

    Huawei P Smart with Android 9.0 Pie

    Target API Level Android 9.0 'Pie' (API level 28) / Automatic (highest installed)

    Timer for next reward is 00:00:00 with Android 9.0
    Timer works with Android 8/8.1 and lower

    I have this problem:
    with <application android=""usesCleartextTraffic = "true" /> --> build ok but no icon and I can't open the app

    It seams that android doesn't recognize the app; instead of the app's name I have "com.MyCompanyName.MyAppName"

    Even if I try to create the build with "Target API Level Android 8" the app doesn't open. No problem if I remove the line of code.

    This is my Android manifest content located in "Assets\Plugins\Android":

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
    3.   <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    4.   <application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name">
    5.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
    6.       <intent-filter>
    7.         <action android:name="android.intent.action.MAIN" />
    8.         <category android:name="android.intent.category.LAUNCHER" />
    9.       </intent-filter>
    10.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    11.     </activity>
    12.     <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    13.     <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    14.     <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    15.     <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    16.     <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    17.     <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    18.     <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    19.     <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    20.     <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb281153705882157" />
    21.     <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="true" />
    22.     <meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled" android:value="true" />
    23.     <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider281153705882157" android:exported="true" />
    24.    
    25.   </application>
    26. <application android:usesCleartextTraffic="true" />
    27. </manifest>
    By the way I have a second android manifest located in "Assets\Plugins\Android\common_lib":
    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest
    3.     xmlns:android="http://schemas.android.com/apk/res/android"
    4.     package="com.voxelbusters.commonlib"
    5.     android:versionCode="1"
    6.     android:versionName="1.0">
    7.  
    8.     <uses-sdk android:minSdkVersion="8" />
    9.  
    10.     <application>
    11.     </application>
    12.  
    13. </manifest>
    14.  
    I had installed the VoxelBuster Cross Platform Native Plugins - Lite Version but I delete it because the free version didn't had what I needed but it seams that something is remained in the project.

    Is that the problem?
     
  10. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Can you share log errors?

    Please check this post: https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted

    For a few solutions if you're having the "Cleartext HTTP traffic not permitted" error.
     
  11. reddo1987

    reddo1987

    Joined:
    Aug 1, 2014
    Posts:
    35
    Hi,
    I have added

    "android:usesCleartextTraffic="true"" and

    <uses-permission android:name="android.permission.INTERNET" />

    to my android manifest file

    and it WORKS now with both Target API Level: Android 9.0 Pie (Api level 28) and Automatic (highest installed).

    Thank you for the assistance
     
  12. surfuay

    surfuay

    Joined:
    Sep 4, 2018
    Posts:
    12
    Hi this is awesome but I was wondering if you could do a tutorial or explanation on how the timespan and difference works. I'm faily new to coding and I'd like to manipulate the timed rewards a little further.
     
  13. pedro_bento_dev

    pedro_bento_dev

    Joined:
    Jan 8, 2019
    Posts:
    1
    My project's run into a couple of issues with the Timed Rewards. The "now" variable doesn't seem to get updated when loading into a scene until after the timer is loaded, which makes the timer stay at the value it was at previously.
     
  14. unity_Qamrcd9ZarNY9g

    unity_Qamrcd9ZarNY9g

    Joined:
    Jan 24, 2019
    Posts:
    2
    please change the Http to Https ...

    Thank You
     
  15. smokinpuppy

    smokinpuppy

    Joined:
    Sep 1, 2018
    Posts:
    39
    Hi,

    I have a game that presents a tutorial video the first time a player plays the game, so I'd like to hide the daily rewards window (at the start of tutorial) then show it again (after tutorial is finished).

    I've tried to set DailyRewards.GetInstance().gameObject.SetActive(false); and then true, but that only hides the window, then I get an "Object reference not set to an instance of an object" error when it should show.

    Then I tried to do that same but first setting a private DailyRewards object "dailyRewardsWindow = DailyRewards.GetInstance()" => "dailyRewardsWindow.gameObject.SetActive(true)" which didn't produce the the error but also didn't show the Daily Reward window either.

    Any help would be much appreciated as I'd also like to show the Reward Windows via a button in the scene.

    Thanks in advance,

    Robert
     
  16. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Robert, you have to hide the Canvas instead of the GameObject. Daily Rewards requires an active instance to sync with time.

    Code (CSharp):
    1. canvas.gameObject.SetActive(false);
     
  17. smokinpuppy

    smokinpuppy

    Joined:
    Sep 1, 2018
    Posts:
    39
    Awesome, thank you :) That worked thank you.
     
  18. smokinpuppy

    smokinpuppy

    Joined:
    Sep 1, 2018
    Posts:
    39
    Hi again @nunesbarbosa, quick question. The first time a player plays my game there is a tutorial video that plays automatically, and the Daily Reward panel is showing. I've tried:

    Code (CSharp):
    1. // in the play tutorial function
    2. DailyRewards.GetInstance().onClaimPrize -= OnClaimPrizeDailyRewards;
    3.         dailyRewardWindowCanvas.gameObject.SetActive(false);
    4.  
    5. // in the end tutorial function
    6. DailyRewards.GetInstance().onClaimPrize += OnClaimPrizeDailyRewards;
    7.         dailyRewardWindowCanvas.gameObject.SetActive(true);
    and also without unsubscribing/resubscribing to the onClaimPrize event as well (i.e. keeping it subscribed onEnable)

    Is there a way to disable and then reenable that will hide it?

    Thank you in advance,

    Robert
     
    Last edited: May 19, 2019
  19. smokinpuppy

    smokinpuppy

    Joined:
    Sep 1, 2018
    Posts:
    39
    Any help from anyone on this would be super helpful
     
  20. smokinpuppy

    smokinpuppy

    Joined:
    Sep 1, 2018
    Posts:
    39
    Hi, I have a strange issue, I imported the firebase analytics package an now my daily rewards count down isn't working what could the problem be?
     
  21. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Hi Robert,
    sorry for the delay. I haven't received your notification in the forums for some reason.

    You can uncheck the "Keep Open" flag on Daily Rewards. Then open the canvas manually through code.

    Regards!
     
  22. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Hi smokinpuppy,
    I assume you're on an Android build?

    please check AndroidManifest.xml for any changes. Maybe Firebase Analytics removed the
    <application android=""usesCleartextTraffic = "true" />

    Please look in the log for errors and post here.

    Regards!
     
  23. smokinpuppy

    smokinpuppy

    Joined:
    Sep 1, 2018
    Posts:
    39
    Thanks for your answers, I'll try and get back to you. I also didn't receive a notification about your reply.
     
  24. dirilikerhan355

    dirilikerhan355

    Joined:
    Nov 15, 2013
    Posts:
    1
    you need world clock json. http://worldtimeapi.org/
     
  25. RocketBoyStudioGames

    RocketBoyStudioGames

    Joined:
    Mar 20, 2015
    Posts:
    3
    Can I customize the graphics with my own?
     
  26. gnolmon

    gnolmon

    Joined:
    Sep 30, 2014
    Posts:
    1
    How can I create multiple Time Reward because I using 2 prefabs Time Reward but only 1 working ?
    I already set up with different instance ID.

    upload_2019-8-5_16-16-21.png
     
  27. Vauxvogh

    Vauxvogh

    Joined:
    Nov 29, 2017
    Posts:
    10
    Hey There I believe world clock is down again :(
     
  28. Vauxvogh

    Vauxvogh

    Joined:
    Nov 29, 2017
    Posts:
    10
    I think its undergoing maintenance it says
     
  29. Vauxvogh

    Vauxvogh

    Joined:
    Nov 29, 2017
    Posts:
    10
    Hey World Clock is down completely this time. Can you please replace?
     
  30. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Vauxvogh, the latest Daily Rewards update have multiple cloud clocks. including world clock and world time api.

    If one is down it tries to connect to the other. I hope it helps!
     
  31. GS796

    GS796

    Joined:
    Dec 16, 2016
    Posts:
    24
    @nunesbarbosa Great asset, easy to use.
    I would like to have a UI button for the Daily Rewards similar to the Timed Rewards- where users can see in the GUI the time left to the next daily reward and even click the button and see the interface to see what day they are on. Before I hack up the scripts- is there an easy way to go about this?
    Thanks!
     
  32. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Hi there,
    very nice Asset! checked few similar ones and find that yours are best and closest to that I need right now.

    Just tested FREE version - looks good! :) Couple questions before I can buy Pro:
    -is it possible to remake Unity's UI in your asset to NGUI ?
    I'm using NGUI and quite familiar with both, have already done such swap for other assets.

    -can I use hourly settings in your Asset Pro version?
    e.g. instead of rewarding users daily, give them rewards every 3/6/12 hours instead?
    Is it possible to configure like that?
    Appreciate your answers!
     
    interpretasyo likes this.
  33. interpretasyo

    interpretasyo

    Joined:
    Jun 18, 2019
    Posts:
    33
    Hi,

    Testing the free version.

    This error always comes out:
    NullReferenceException: Object reference not set to an instance of an object
    IntegrationDailyRewards.OnDisable () (at Assets/DailyRewards/Scripts/IntegrationDailyRewards.cs:18)


    NullReferenceException: Object reference not set to an instance of an object
    IntegrationDailyRewards.OnDisable () (at Assets/DailyRewards/Scripts/IntegrationDailyRewards.cs:23)

    line 18:
    DailyRewards.GetInstance().onClaimPrize += OnClaimPrizeDailyRewards;
    line 23:
    DailyRewards.GetInstance().onClaimPrize -= OnClaimPrizeDailyRewards;


    setup:
    instance id = 0
    is singleton = true
    keep open = false
     
  34. interpretasyo

    interpretasyo

    Joined:
    Jun 18, 2019
    Posts:
    33
    Hi,

    How will I connect the rewards to the items that I currently have? The reward coins count is adding but not towards the coin that I need.

    Also, do you have another contact for those that bought the asset? It seems quiet in here. I'm thinking that there's some discord channel or anything for this community. Thanks!
     
  35. interpretasyo

    interpretasyo

    Joined:
    Jun 18, 2019
    Posts:
    33
    I guess no more support for this? Luckily, haven't buy this yet.
     
  36. payalzariya07

    payalzariya07

    Joined:
    Oct 5, 2018
    Posts:
    85
    hi,
    I 'm used user plugin.I got error in offline timer is not working.It not showing updated timer.
    What i can do in offline to calculate time Reward?
     
  37. interpretasyo

    interpretasyo

    Joined:
    Jun 18, 2019
    Posts:
    33
    What do you mean by used user plugin?
     
  38. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Hi Payalzariya07,
    If you're using Daily Rewards with the Timer Servers and the player is offline Daily Rewards won't work. This is a way to prevent player cheating. Can you post the exception? Thanks!
     
  39. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Hi interpretasyio,
    this is a harmless exception depending on the destroy order. I'll fix that in future versions. Meanwhile you can add a simple check at IntegrationDailyRewards.cs: 23:

    Code (CSharp):
    1. if(DailyRewards.GetInstance() != null)
    2.         DailyRewards.GetInstance().onClaimPrize -= OnClaimPrizeDailyRewards;
     
    interpretasyo likes this.
  40. dotedison

    dotedison

    Joined:
    Dec 12, 2018
    Posts:
    1
    I currently have the same problem. Did you figure out the solution?
     
  41. HajiyevEl

    HajiyevEl

    Joined:
    Feb 19, 2020
    Posts:
    46
    Hi nunesbarbosa, i'm a newbie, and i have a problem when changing scenes or simply reloading current scene.

    MissingReferenceException: The object of type 'Text' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    FortuneWheelManagerRemade.RewardCoins (System.Int32 awardCoins) (at Assets/FortuneWheel/Scripts/FortuneWheelManagerRemade.cs:182)
    TimedRewardsIntegration250.OnClaimPrizeTimedRewards (System.Int32 index) (at Assets/Scripts/ClockRewardScripts/TimedRewardsIntegration250.cs:37)
    NiobiumStudios.TimedRewards.ClaimReward (System.Int32 rewardIdx) (at Assets/DailyRewards/Scripts/TimedRewards.cs:134)
    NiobiumStudios.TimedRewardsInterface.ClaimReward (System.Int32 index) (at Assets/DailyRewards/Examples/Scripts/TimedRewardsInterface.cs:180)
    NiobiumStudios.TimedRewardsInterface.<Start>b__20_1 () (at Assets/DailyRewards/Examples/Scripts/TimedRewardsInterface.cs:80)
    UnityEngine.Events.InvokableCall.Invoke () (at <d815b7efac424eeb8e053965cccb1f98>:0)
    UnityEngine.Events.UnityEvent.Invoke () (at <d815b7efac424eeb8e053965cccb1f98>:0)
    UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2019.3.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.3.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.3.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2019.3.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
    UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.3.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

    Googled a little and i think i found the root of problem:

    https://answers.unity.com/questions/1015411/missingreferenceexception-the-object-of-type-text.html
    I think that's it, but i don't know what event handlers are and don't know where in your script they are located.
    Also found this thread on forum with "solution", but once again can't put into practice cuz im newbie.

    https://forum.unity.com/threads/the...but-you-are-still-trying-to-access-it.454891/

    I only have 2 scenes in my game - Game scene and Menu scene. Game scene works fine till i go to Menu and back.
    Help please?
     
  42. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Hi @HajiyevEl,
    this is a common issue when using delegates. I believe you're using the Singleton option and a instantiable Canvas or integration script. Take a look at your integration script and see if you're calling:

    Code (CSharp):
    1. void OnDisable()
    2.     {
    3.         DailyRewards.GetInstance(0).onClaimPrize -= OnClaimPrizeDailyRewards;
    4.     }
    5.  
    More information is at page 7 of the docs: https://docs.google.com/document/d/1XPGqr7micibB6zRItSbpduSGOmvydUZ87fEFPrmN9_U
     
  43. HajiyevEl

    HajiyevEl

    Joined:
    Feb 19, 2020
    Posts:
    46
    I'm using copy paste script from examples. I have 2 prefabs of TimedRewards in scene. Prefabs have id 0 and id 1 respectively. Singleton is ON on both.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using NiobiumStudios;
    5.  
    6. public class TimedRewardsIntegration250 : MonoBehaviour
    7. {
    8.     FortuneWheelManagerRemade awardCoins;
    9.  
    10.     private void Start()
    11.     {
    12.         awardCoins = GetComponent<FortuneWheelManagerRemade>();
    13.     }
    14.  
    15.     void OnEnable()
    16.     {
    17.         TimedRewards.GetInstance(0).onClaimPrize += OnClaimPrizeTimedRewards;
    18.     }
    19.  
    20.     void OnDisable()
    21.     {
    22.         if (TimedRewards.GetInstance(0) != null)
    23.         {
    24.             TimedRewards.GetInstance(0).onClaimPrize -= OnClaimPrizeTimedRewards;
    25.         }
    26.     }
    27.  
    28.     // this is your integration function. Can be on Start or simply a function to be called
    29.     public void OnClaimPrizeTimedRewards(int index)
    30.     {
    31.         // This returns a Reward object
    32.         Reward myReward = TimedRewards.GetInstance(0).GetReward(index);
    33.  
    34.  
    35.         awardCoins.RewardCoins(myReward.reward);
    36.    
    37.  
    38.         // And you can access any property
    39.         print(myReward.unit);   // This is your reward Unit name
    40.         print(myReward.reward); // This is your reward count
    41.  
    42.         //var rewardsCount = PlayerPrefs.GetInt("MY_REWARD_KEY", 0);
    43.         //rewardsCount += myReward.reward;
    44.  
    45.         //PlayerPrefs.SetInt("MY_REWARD_KEY", rewardsCount);
    46.         //PlayerPrefs.Save();
    47.     }
    48.  
    49.  
    50. }
    51.  
    All works properly in first scene. After reloading scene have the same error as i posted before.
    BTW i used...
    Code (CSharp):
    1. if (awardCoins != null)
    2.         {
    3.             awardCoins.RewardCoins(myReward.reward);
    4.         }
    ... to skip if integration couldn't find gameobject in my scene. It worked. BUT! I have 2 prints per click on any reward in debug in first scene. If i reload scene, on click i have 4 prints per click on any reward and so on, so forth... If i'm not wrong somehow event doesn't unsubscribe when reloading scene i.e. this
    Code (CSharp):
    1.  void OnDisable()
    2.     {
    3.         if (TimedRewards.GetInstance(0) != null)
    4.         {
    5.             TimedRewards.GetInstance(0).onClaimPrize -= OnClaimPrizeTimedRewards;
    6.         }
    7.     }
    doesn't work for me. I tried to unsubscribe onDestroy() but it was unsuccessful. I have integration script placed on gameobject which gets destroyed on scene reloading (no DontDestroyOnLoad attached to it)

    BTW, if i don't use Singleton all working alright. Even prints coming in proper quantity. But, it so happens that i need it to be Singleton so that timer goes on in any event.
    Help me unsubscribe that event please? Or maybe problem not with event but elsewhere?
     
    Last edited: May 5, 2020
  44. unity_TDkmLyQfc3QYFQ

    unity_TDkmLyQfc3QYFQ

    Joined:
    Apr 27, 2020
    Posts:
    1
    Check out to remove all the calls to SnapToReward() method in DailyRewardInterface. Call that method in start after:
    void Start()
    {

    InitializeDailyRewardsUI();
    SnapToReward();
    ...
    }
     
  45. Charlessmith

    Charlessmith

    Joined:
    Oct 8, 2019
    Posts:
    2
    Guyz. i facing an issue. i have done all the thing in a way which mentioned in tutorial for free version. but when i play the game it deleted the daily rewads landscape prefeb from scene

    Any help??
     
  46. nunesbarbosa

    nunesbarbosa

    Joined:
    Jul 17, 2012
    Posts:
    103
    Hi!
    make sure you're not calling GetInstance() from inside an Awake() method. Call from a Start() method instead.
     
  47. interpretasyo

    interpretasyo

    Joined:
    Jun 18, 2019
    Posts:
    33
    Thank you.
     
  48. UDN_449900de-7c34-4a67-83eb-fa8501bf0413

    UDN_449900de-7c34-4a67-83eb-fa8501bf0413

    Joined:
    Jun 16, 2017
    Posts:
    17
    Hey, so first off i love this asset but i have one question. I have a game mmo game, where you can have more then one account, but that also means that when i claim the reward on one account then i cant claim it on other accounts, is there a soluttion to this??
     
  49. georgikgeo25

    georgikgeo25

    Joined:
    Mar 24, 2020
    Posts:
    5
    "Evitați înșelăciunea jucătorului schimbând ceasul dispozitivului! Acest activ utilizează un mecanism anti-înșelăciune care folosește un ceas de rețea."

    O minciună schimbă data și schimbă și cronometrează un rahat
     
  50. santhu9490

    santhu9490

    Joined:
    Feb 25, 2020
    Posts:
    4
    ok , good