Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Latest 3.1.0 IAP Validator error

Discussion in 'Unity IAP' started by justtime, May 15, 2021.

  1. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    422
    Hi there! Unity 2019.4.26f, IAP 3.1.0. I have 2 projects with this error in the Editor: new sample IAP project and my project, upgraded following upgrade guide.
    1 case. New sample IAP project. Steps
    1)Click initialize. "Starting Initialized...", "OnInitialized: PASS"
    2)Click Non-Cosumable. "Purchasing product:nonconsume1", "Error is The type initializer for 'UnityEngine.Purchasing.Security.GooglePlayTangle' threw an exception.", "ProcessPurchase: nonconsume1".

    2 case, my project.
    "NotImplementedException: The method or operation is not implemented.
    UnityEngine.Purchasing.Security.Obfuscator.DeObfuscate (System.Byte[] data, System.Int32[] order, System.Int32 key)"
    at GooglePlayTangle.cs line 15.
    Previous step, which invokes GooglePlayTangle
    "CrossPlatformValidator validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.identifier);"
     
  2. Sherwinnie

    Sherwinnie

    Joined:
    Jan 24, 2020
    Posts:
    19
    justtime likes this.
  3. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    422
    Thanks. I saw this try/catch in example, but it's not clear that this behavior is OK. I agree that this step must be done under the hood of IAP package. JeffDUnity3D
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    The validator only works on iOS or Android devices, you'll want to wrap it in a Try/Catch block on other platforms or in the Editor. This is by design.
     
  5. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,058
    Why is this by design? Why not have this simulated to work in editor?
     
  6. JParish2590

    JParish2590

    Joined:
    Jan 8, 2014
    Posts:
    31
    Yeah in previous versions this worked with it just giving it to the player now we dont have this function... seems weird to remove it
     
  7. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,058
    I don't understand the reason for removing editor testing for IAP...
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    We didn't remove editor testing. You simply need to wrap the method in a try/catch block. We've never had a back-end store with receipts for the editor, the validator silently failed. I've mentioned to the developers that a separate return code would be preferable than a raised exception. But in the meantime, just use a try/catch block and you can continue your editor testing.
     
  9. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    137
    Struggling to understand why UNITY didn't simply include the TRY/CATCH block for other platforms (OSX for example). Its like making a partially built product.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Understood, but now you know! And you have a point, I've mentioned to the dev team also. We are working on an improved implementation that should make IAP much easier to work with. Edit - I love your animated profile image, I've never seen that on here before!