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

Nice! Thanks for shaing!

2 Likes

Fantastic! Thank you for sharing!

2 Likes

Just made first update - removed one unneed delegate.

And I found an issue with “Sign IOS App…” maybe @sven or @britzl know what it can be?
Issue:

  • I install “Sign IOS App…” dmengine to my ipad;
  • change example project - made an unityads.initialization in init() method of script;
  • cmd+b example project;
  • it will initialized but when I tap to show ad - it doesn’t show. Looks like it shows somewhere in background.
    I have no this issue in the bundle build. And all fine when I made unityads.initialization in other place (not in init method)

Do you know what can it be?

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