|Attention||Topic was automatically imported from the old Question2Answer platform.|
Using Applovin Max plugin, Godot says id is not defined in the current scope when using callbacks with id argument.
Can you post the offending code?
jgodfrey | 2022-12-16 14:38
I’m using NativeLib by Dr. Moriarty.
applovin_max is in autoload.
applovin_max.loadInterstitial("MAX AD UNIT ID", self.get_instance_id())
func _on_interstitial_loaded(id): applovin_max.showInterstitial(id)
i followed a tutorial on youtube by finepointcgi and it worked fine for him.
Maz90 | 2022-12-16 16:30
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:
Can you provide a video time code where Mitch is making the same
_on_interstitial_loaded() call you show above?
jgodfrey | 2022-12-16 16:48
- 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
LoadInter()call is wired to his test button
- That function calls the libraries
loadInterstitial()function and passes the copied ID in.
loadInterstitial() call the triggers the
_on_interstitial_loaded() callback and passes in the specified ID.
AFAIK, you shouldn’t be directly calling
jgodfrey | 2022-12-16 16:56
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 Java_org_godotengine_godot_GodotLib_calldeferred: Parameter “obj” is null.
<C++ Source> platform/android/java_godot_lib_jni.cpp:471 @ Java_org_godotengine_godot_GodotLib_calldeferred()
i’m not sure if its the Applovin plugin or smt else.
Maz90 | 2022-12-16 17:27
Looks like the code for that video is on GitHub, here. Maybe you can spot the difference there?
jgodfrey | 2022-12-16 17:32