Skip to Content
defold-typescript libraries
potatojamdefold-ads-wrapper

potatojam/defold-ads-wrapper/ads_wrapper.ads_networks.unity

Ads Wrapper network for Unity Ads on Android and iOS, through the DefVideoAds extension.

  • GitHub: potatojam/defold-ads-wrapper — pinned to 1.5.1
    1. Pick a release from potatojam/defold-ads-wrapper releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as ads_networks_unity from "ads_wrapper.ads_networks.unity"

Functions

setup(params: LuaTable)

Api setup

Parameters

  • params: LuaTable

init(callback?: ads_callback | undefined)

Initializes unityads sdk.

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

request_idfa(callback?: ads_callback | undefined)

Requests IDFA

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

is_supported(): boolean

Check if the environment supports unity ads api

Returns

  • boolean

is_initialized(): boolean

Check if the unity ads is initialized

Returns

  • boolean

show_rewarded(callback?: ads_callback | undefined)

Shows rewarded ads.

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

load_rewarded(callback?: ads_callback | undefined)

Loads rewarded ads

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

is_rewarded_loaded(): boolean

Check if the rewarded ads is loaded

Returns

  • boolean

show_interstitial(callback?: ads_callback | undefined)

Shows interstitial ads.

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

load_interstitial(callback?: ads_callback | undefined)

Loads interstitial ads

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

is_interstitial_loaded(): boolean

Check if the interstitial ads is loaded

Returns

  • boolean

is_banner_setup(): boolean

Check if the banner is set up

Returns

  • boolean

load_banner(callback?: ads_callback | undefined)

Loads banner. Use ads.T_BANNER parameter.

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

unload_banner(callback?: ads_callback | undefined)

Unloads active banner.

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

is_banner_loaded(): boolean

Check if the banner is loaded

Returns

  • boolean

show_banner(callback?: ads_callback | undefined)

Shows loaded banner.

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

hide_banner(callback?: ads_callback | undefined)

Hides loaded banner.

Parameters

  • callback?: ads_callback | undefined — the function is called after execution.

set_banner_position(position: number): ads_response

Sets banner position. Possible positions: unityads.BANNER_POSITION_TOP_LEFT unityads.BANNER_POSITION_TOP_CENTER unityads.BANNER_POSITION_TOP_RIGHT unityads.BANNER_POSITION_BOTTOM_LEFT unityads.BANNER_POSITION_BOTTOM_CENTER unityads.BANNER_POSITION_BOTTOM_RIGHT unityads.BANNER_POSITION_CENTER

Parameters

  • position: number — banner position

Returns

  • ads_response

set_banner_size(size: LuaTable): ads_response

Sets banner size. It is imperative to reload the banner again after this function.

Parameters

  • size: LuaTable — table {width = number, height = number}

Returns

  • ads_response

is_banner_showed(): boolean

Check if the banner is showed

Returns

  • boolean

On this page