0 votes

Using Applovin Max plugin, Godot says id is not defined in the current scope when using callbacks with id argument.

Godot version 3.5.1
in Engine by (36 points)

Can you post the offending code?

I'm using NativeLib by Dr. Moriarty.
applovin_max is in autoload.

loading interstitial (first arg should be replaced with ad unit id from Applovin MAX):

applovin_max.loadInterstitial("MAX AD UNIT ID", self.get_instance_id())

later function on loaded then show the ad:

func _on_interstitial_loaded(id):
applovin_max.showInterstitial(id)

finally call the function to show the ad (the id argument throws an error):

_on_interstitial_loaded(id)

i followed a tutorial on youtube by finepointcgi and it worked fine for him.

So, you're code is CALLING the _on_interstitial_loaded() function? I'm not familiar with this library, but I'd expect that function (presumably a callback) to be called by the library itself when the interstitial ad loads.

However, if you really are supposed to call it yourself, you'll need to define some sort of id.

I assume this is the tutorial you watched:

https://www.youtube.com/watch?v=9UUGeQ32ArY

Can you provide a video time code where Mitch is making the same _on_interstitial_loaded() call you show above?

  • At about 34 minutes, he copies the ID for the interstitial ad from the AppLovin site.
  • At about 34:25, he creates a LoadInter() function to load an ad
  • That LoadInter() call is wired to his test button
  • That function calls the libraries loadInterstitial() function and passes the copied ID in.

It's that loadInterstitial() call the triggers the _on_interstitial_loaded() callback and passes in the specified ID.

AFAIK, you shouldn't be directly calling _on_interstitial_loaded()...

in minute 18:50 he only gives the ad is once to the applovin_max.loadBanner method. same when calling the loadInterstitial method.

I passed the id to the functions when i call them and it worked.
in the video he doesn't pass the ad id when calling the functions.
now an error pops up when i run the game on a phone:


E 0:01:02.322 JavaorggodotenginegodotGodotLibcalldeferred: Parameter "obj" is null.
<C++ Source> platform/android/java
godotlibjni.cpp:471 @ JavaorggodotenginegodotGodotLib_calldeferred()


i'm not sure if its the Applovin plugin or smt else.

Looks like the code for that video is on GitHub, here. Maybe you can spot the difference there?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.