defold-extension-unity-ads icon indicating copy to clipboard operation
defold-extension-unity-ads copied to clipboard

step by step documentation

Open OURABIG opened this issue 2 years ago • 9 comments

i would like to add ads to my game but when i try this i get confused and i always have errors maybe if you can just make a step by step setup tutorial and how to show an ad like in a wiki or in a video and thanks for this amazing extension

OURABIG avatar May 14 '23 12:05 OURABIG

@OURABIG please share what exactly errors you have

AGulev avatar May 14 '23 12:05 AGulev

@OURABIG please share what exactly errors you have

well everything i can't even setup the ads or initialize them i just got confused to do it

OURABIG avatar May 17 '23 09:05 OURABIG

Did you see the example in this repo?

AGulev avatar May 17 '23 10:05 AGulev

Did you see the example in this repo?

yes of course and i didn't understand a lot it's a bit advance what should i create first

OURABIG avatar May 17 '23 10:05 OURABIG

you said :

i always have errors

What kind of errors do you have? The install process is simple as:

  • initialize
  • wait when initialization is done
  • show ads

AGulev avatar May 17 '23 11:05 AGulev

you said :

i always have errors

What kind of errors do you have? The install process is simple as:

* initialize

* wait when initialization is done

* show ads

so i add the direcrly in .gui_script no need to another script

OURABIG avatar May 17 '23 18:05 OURABIG

you said :

i always have errors

What kind of errors do you have? The install process is simple as:

* initialize

* wait when initialization is done

* show ads

i add initialize function and unity ads code then i go when button is clicked show ads is this what i need to do

OURABIG avatar May 17 '23 18:05 OURABIG

  1. Initialize SDK with callback (third parameter isDebug): https://github.com/AGulev/DefVideoAds/blob/abaeb8f6902457c638b3b08ab4e69ee567dd8b79/example/ui.gui_script#L217

Here is an example of the callback function: https://github.com/AGulev/DefVideoAds/blob/abaeb8f6902457c638b3b08ab4e69ee567dd8b79/example/ui.gui_script#L76-L189

  1. Wait for unityads.EVENT_COMPLETED in unityads.MSG_INIT :

https://github.com/AGulev/DefVideoAds/blob/abaeb8f6902457c638b3b08ab4e69ee567dd8b79/example/ui.gui_script#L79-L82

  1. When it's done, you are able to use ADS functions. First of all you need to load ADS (in this function you use placementId of your AD as the first/only parameter):

https://github.com/AGulev/DefVideoAds/blob/abaeb8f6902457c638b3b08ab4e69ee567dd8b79/example/ui.gui_script#L341

  1. When loading is done, you'll get unityads.EVENT_LOADED for message_id unityads.MSG_LOAD in the callback:

https://github.com/AGulev/DefVideoAds/blob/abaeb8f6902457c638b3b08ab4e69ee567dd8b79/example/ui.gui_script#L130-L134

  1. Now you can show ADS (in this function you use placementId of your AD as the first/only parameter):

https://github.com/AGulev/DefVideoAds/blob/abaeb8f6902457c638b3b08ab4e69ee567dd8b79/example/ui.gui_script#L346

  1. For the show() function you should use this message_id in the callback: https://github.com/AGulev/DefVideoAds/blob/abaeb8f6902457c638b3b08ab4e69ee567dd8b79/example/ui.gui_script#L94-L109

AGulev avatar May 17 '23 20:05 AGulev

Also, you can take a look this ads_wrapper , maybe it will be easier for you.

AGulev avatar May 17 '23 20:05 AGulev