DefVideoAds (plugin for Unity ADS). Video ADS native extension

I have no idea to be honest. @sven or @Mathias_Westerdahl probably knows though.

1 Like

As I understand something happen with main view and it happen after lua init methods in scripts.

When I try to add next code to show method - ad works good.

    UIView *view = dmGraphics::GetNativeiOSUIView();
    unityAds.view.bounds = view.bounds;
    [view addSubview:unityAds.view];

Looks like nativeiosview remove all chield view or something like this. But I don’t understand why it happen after init methods…

Now, when bug with UIWindow (1.2.103) fixed, i have one more question.

As I understand, Unity Ads delegate should be a UIViewController.
I adding this view to scene next way (using app UIView that I recieve using GetNativeiOSUIView()):

   UIView *view = dmGraphics::GetNativeiOSUIView();
    unityAds = [[DefUnityAdsDelegate alloc] init];
    unityAds.view.bounds = view.bounds;
    [view addSubview:unityAds.view];

I am bad in IOS, maybe somebody know… Now when we have UIWindow, should I change this code? And add the view to application view hierarchy some other way?

(prev question about init method and UIView initialization when i use dmengine still opened. And maybe the answer to this question will help with the previous one)
Thank you!

1 Like

DefUnityAds updated.
Now it support android too.

10 Likes

Amazing! Well done!

3 Likes

I just updated DefUnityAds. Now it is more stable.
The problem was in async callbacks in another thread and it was a cause of app crash in some cases on Android.

Now this problem solved. Pls update DefUnityAds, especially if you build android apk.

6 Likes

I made a commit with a stability improvements on android, thanks for the bug report @jouni.petteri.pekone

I am happy that somebody use DefUnityAds! :joy_cat:

8 Likes

Just integrated this into my own project. I think it took 30 minutes tops to get it working on device! Great work :smiley:

6 Likes

Agreed, just deploy Free game build with DefUnityAds - easy to use and good working. Good library from good dev.

5 Likes

Thank you for kind words.

I made a small DefUnityAds update:

  • Unity Ads lib updated to version 2.1.1;
  • extension now working with dmengine and multiple run of project;
  • added debug logs for unsopported platforms (macos, windows etc).
10 Likes

It seems to crash if you run dmengine 1.2.114 and iOS 11.0.2 at least. No idea why, just wanted to report it.

3 Likes

Thank you for the report. I’ll try to fix.

3 Likes

Small update:

7 Likes

One more small update:

  • Unity Ads lib updated to version 2.1.2.
5 Likes

New one update:

  • Unity ADS lib updated to 2.2 (still have no documentation for new api methods. For now it just lib update)

  • Few fix for android integration (was deleted local JNI references for java variables)

UPD:

Finally released DefUnityADS 1.0.0

NEW: added unityads.getPlacementState()

UPD 1.0.1 :
Unity ADS SDK was updated to latest version (2.2.1)
New version may crash on iOS (this is bug of original Unity sdk, not mine) if you try to show ads before initialization. Be careful and use isReady() method before Show() (without parameters) .

UPD 1.1.1 :
UnityAds plugin has strange crash in iOS 11.3.1 - isReady() and show() and getPlacementState() method doesn’t work without placementId parameter. I’ll try to understand what’s wrong with my code in new ios, but for now I made a hotfix. Now you receive a lua error (without crash) when you try to use isReady() or show() without placementId.
Thanks @karawra for the report and @Dragosha for helping with testing (i have no needed device)!

UPD 1.2.0 :
Fixed bug with isReady(), show(), getPlacementState() without placementId parameter. You can use those methods with defaults parameter again.
Fixed bug with UnityAds, when you try to call show() before sdk initialisation.

10 Likes

I’m going to soon test using DefUnityAds exclusively for rewarded video monetization on a project for iOS/Android.

4 Likes

I’m assuming the extension, being it based on the sdk 2.0+, is going to be GDPR compliant?

1 Like

I’m following the updates:

1 Like

DefUnityAds was updated to 1.3.0

  • New method setCallback() added.
  • DefUnityCallback refactoring.

When you relaunch your game directly on device from editor (dmengine) or your game resources was unloaded by system because of long waiting on background. In these cases UnityAds will be still inited (return true after call unityads.isInitialized()) but you have to set new one callback and unityads.setCallback(callback) will be useful here.

DefUnityAds was updated to 1.3.1 (polishing, polishing, polishing)
Now you can remove callback using unityads.setCallback() or unityads.setCallback(nil).
DefUnityAds callback won’t run when the instance has been deleted.

(DefUnityAds now is DefVideoAds)
DefVideoAds was updated to 1.4.0
Unity ADS SKD updated to version 2.3

5 Likes

Great work on the extension.

I noticed on the first init and before the callback is registered there is some blocking. This will cause a touch to be delayed in that time.

After first init everything is fine.

I am unsure how to profile or isolate it more I did try running with a release build and get the same issue.

5 Likes