adaptyteam / AdaptySDK-Unity

Unity SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
50 stars 4 forks source link

Adapty SDK Unity #10

Closed marvpaul closed 2 months ago

marvpaul commented 4 months ago

I installed the SDK and trying to use within the Unity Editor. Three questions:

I get the following error when requesting a paywall:

AdaptyUnityError.DecodingFailed(System.NullReferenceException: Object reference not set to an instance of an object
  at AdaptySDK.SimpleJSON.JSONNode.Parse (System.String aJSON) [0x003cb] in /Users/marvinkruger/MusicVis copy/Assets/AdaptySDK/JSON/SimpleJSON.cs:517 
  at AdaptySDK.SimpleJSON.JSONNodeExtensions.ExtractPaywallOrError (System.String json) [0x00004] in /Users/marvinkruger/MusicVis copy/Assets/AdaptySDK/JSON/Result+JSON.cs:45 )
 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
 #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
 #4  (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
 #5  (Mono JIT Code) [Logger.cs:61] UnityEngine.Logger:Log (UnityEngine.LogType,object)
 #6  (Mono JIT Code) [Debug.bindings.cs:102] UnityEngine.Debug:Log (object)
 #7  (Mono JIT Code) [SubscriptionWindow.cs:28] SubscriptionWindow/<>c:<Start>b__9_0 (AdaptySDK.Adapty/Paywall,AdaptySDK.Adapty/Error)
 #8  (Mono JIT Code) [Adapty.cs:91] AdaptySDK.Adapty/<>c__DisplayClass7_0:<GetPaywall>b__0 (string)
 #9  (Mono JIT Code) [AdaptyNoop.cs:14] AdaptySDK.Noop.AdaptyNoop:GetPaywall (string,string,string,System.Nullable`1<long>,System.Action`1<string>)
 #10  (Mono JIT Code) [Adapty.cs:98] AdaptySDK.Adapty:GetPaywall (string,string,AdaptySDK.Adapty/PaywallFetchPolicy,System.Nullable`1<System.TimeSpan>,System.Action`2<AdaptySDK.Adapty/Paywall, AdaptySDK.Adapty/Error>)
 #11  (Mono JIT Code) [Adapty.cs:61] AdaptySDK.Adapty:GetPaywall (string,string,System.Action`2<AdaptySDK.Adapty/Paywall, AdaptySDK.Adapty/Error>)
 #12  (Mono JIT Code) [SubscriptionWindow.cs:45] SubscriptionWindow:Start ()
 #13  (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
 #14 mono_jit_runtime_invoke
 #15 do_runtime_invoke
 #16 mono_runtime_invoke
 #17 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
 #18 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
 #19 MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingExceptionPtr*)
 #20 MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr)
 #21 MonoBehaviour::DelayedStartCall(Object*, void*)
 #22 DelayedCallManager::Update(int)
 #23 InitPlayerLoopCallbacks()::EarlyUpdateScriptRunDelayedStartupFrameRegistrator::Forward()
 #24 ExecutePlayerLoop(NativePlayerLoopSystem*)
 #25 ExecutePlayerLoop(NativePlayerLoopSystem*)
 #26 PlayerLoop()
 #27 EditorPlayerLoop::Execute()
 #28 PlayerLoopController::InternalUpdateScene(bool, bool)
 #29 PlayerLoopController::EnterPlayMode()
 #30 PlayerLoopController::SetIsPlaying(bool)
 #31 Application::TickTimer()
 #32 -[EditorApplication TickTimer]
 #33 __NSFireTimer
 #34 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
 #35 __CFRunLoopDoTimer
 #36 __CFRunLoopDoTimers
 #37 __CFRunLoopRun
 #38 CFRunLoopRunSpecific
 #39 RunCurrentEventLoopInMode
 #40 ReceiveNextEventCommon
 #41 _BlockUntilNextEventMatchingListInModeWithFilter
 #42 _DPSNextEvent
 #43 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
 #44 -[NSApplication run]
 #45 NSApplicationMain
 #46 EditorMain(int, char const**)
 #47 main
 #48 start
x401om commented 4 months ago

Hi @marvpaul!

How can I display a paywall? Is Adapty.GetPaywall enough or do I need to explicitly call a "show" method afterwards?

Basically, you have to use the CreatePaywallView method first, and then call Present. You can find all the necessary information in our documentation.

Can we see the configured paywall in the Unity editor or is this only working on ios / android?

Unfortunately, since paywalls are rendered on the native layer, there is no way to preview paywalls within the Unity Editor.

Do the Adapty paywalls support landscape orientation (as in the browser while configuring them, I only can choose portrait mode preview screens)?

Our layouts will work in landscape orientation, but they were designed primarily for use in portrait mode.

Regarding the stack trace you have sent: please provide the exact SDK version. It would also be helpful if you could add a code snippet of how you are using the Adapty SDK in this context.

marvpaul commented 4 months ago

Basically, you have to use the CreatePaywallView method first, and then call Present. You can find all the necessary information in our documentation.

I checked the documentation but as far as I can see it misses the important part regarding "how to display a paywall". Can you let me know where I can find the documentation you're talking about? I checked this so far: https://docs.adapty.io/docs/displaying-products

Regarding the stack trace you have sent: please provide the exact SDK version. It would also be helpful if you could add a code snippet of how you are using the Adapty SDK in this context.

It is the latest SDK version AdaptySDK-Unity-2.9.0 2. I tested on iOS where it's working to fetch the paywall. I only get this error in the editor. To clarify: Is the basic functionality like fetching paywalls working in the Unity editor or is the hole SDK only working on native devices? If so, a small hint would be awesome to point dev's like me in the right direction.

I just copied the sample from the documentation and added my placement id (placement):

Adapty.GetPaywall("placement", "en", (paywall, error) => {
  if(error != null) {
    // handle the error
    return;
  }

  // paywall - the resulting object
});
x401om commented 3 months ago

Hi, @marvpaul, I apologize for the delay; your question went beyond my scope.

Can you let me know where I can find the documentation you're talking about?

You can find all the necessary documentation in the designated section for the Paywall Builder. It includes information about fetching and presenting:

Is the basic functionality like fetching paywalls working in the Unity editor or is the whole SDK only working on native devices?

The entire SDK is functional only on native devices. We currently do not support the Unity Editor. Apologies for any inconvenience this may cause.

For quicker responses to similar questions, I recommend reaching out to our customer support team. They can provide more immediate assistance.

marvpaul commented 2 months ago

Hi, @marvpaul, I apologize for the delay; your question went beyond my scope.

Can you let me know where I can find the documentation you're talking about?

You can find all the necessary documentation in the designated section for the Paywall Builder. It includes information about fetching and presenting:

Is the basic functionality like fetching paywalls working in the Unity editor or is the whole SDK only working on native devices?

The entire SDK is functional only on native devices. We currently do not support the Unity Editor. Apologies for any inconvenience this may cause.

For quicker responses to similar questions, I recommend reaching out to our customer support team. They can provide more immediate assistance.

Thank you! It's working now on my iOS device.