{"id":16085119,"url":"https://github.com/AGulev/defold-extension-unity-ads","last_synced_at":"2025-10-23T01:31:32.037Z","repository":{"id":45190643,"uuid":"89959875","full_name":"AGulev/defold-extension-unity-ads","owner":"AGulev","description":"UnityAds native extension for Defold engine.","archived":false,"fork":false,"pushed_at":"2025-10-04T15:54:16.000Z","size":145140,"stargazers_count":38,"open_issues_count":3,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-04T17:39:16.556Z","etag":null,"topics":["banner","defold","defold-engine","defold-game-engine","defold-library","defold-module","monetization","unity-ads","unityads"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AGulev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-05-01T20:24:34.000Z","updated_at":"2025-10-04T17:38:27.000Z","dependencies_parsed_at":"2024-05-04T08:23:03.269Z","dependency_job_id":"8d7f7da2-ad90-49d1-a032-d00a02b09c87","html_url":"https://github.com/AGulev/defold-extension-unity-ads","commit_stats":null,"previous_names":["agulev/defold-extension-unity-ads"],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/AGulev/defold-extension-unity-ads","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AGulev%2Fdefold-extension-unity-ads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AGulev%2Fdefold-extension-unity-ads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AGulev%2Fdefold-extension-unity-ads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AGulev%2Fdefold-extension-unity-ads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AGulev","download_url":"https://codeload.github.com/AGulev/defold-extension-unity-ads/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AGulev%2Fdefold-extension-unity-ads/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280546390,"owners_count":26348719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["banner","defold","defold-engine","defold-game-engine","defold-library","defold-module","monetization","unity-ads","unityads"],"created_at":"2024-10-09T13:01:51.085Z","updated_at":"2025-10-23T01:31:31.735Z","avatar_url":"https://github.com/AGulev.png","language":"C++","funding_links":[],"categories":["Libraries"],"sub_categories":["Programming Language"],"readme":"_“This plugin is not endorsed or sponsored by Unity Technologies. This is an independent, unofficial plugin. UNITY and the Unity logo are Unity Technologies’ registered trademarks in the US and other countries--All rights reserved.“_\n\n![defvideoads-01](https://user-images.githubusercontent.com/2209596/50695591-6086b080-103d-11e9-9a94-77929169199e.png)\n\n[![Build Status](https://github.com/AGulev/DefVideoAds/workflows/Build%20with%20bob/badge.svg)](https://github.com/AGulev/DefVideoAds/actions)\n\n# DefVideoAds (plugin for Unity ADS)\n\nThis is [UnityAds](https://unity3d.com/ru/services/ads) native extension for [Defold engine](http://www.defold.com).\nExtension supported IOS (minimum iOS version is 9.0) and Android.\n\n## Installation\nTo use this library in your Defold project, add the needed version URL to your `game.project` dependencies from [Releases](https://github.com/AGulev/DefVideoAds/releases)\n\n\u003cimg width=\"401\" alt=\"image\" src=\"https://user-images.githubusercontent.com/2209596/202223571-c77f0304-5202-4314-869d-7a90bbeec5ec.png\"\u003e\n\n\n\n## Example\n\nSee the [example folder](https://github.com/AGulev/DefVideoAds/tree/master/example) for understand how to use extension. Especially [ui.gui_script](https://github.com/AGulev/DefVideoAds/blob/master/example/ui.gui_script) file.\n\n![Example](https://user-images.githubusercontent.com/2209596/124395653-8ae88000-dd05-11eb-99e3-ed09bfadc850.gif)\n\n\n\n## LUA Api\nPlease, read [Android API docs](https://unityads.unity3d.com/help/android/api-android#iunityadsshowlistener) and [iOS API docs](https://unityads.unity3d.com/help/ios/api-ios#unityadsloaddelegate)\n### Methods\n\n#### unityads.request_idfa()\n```lua\nunityads.request_idfa()\n-- iOS only method that shows IDFA request popup.\n-- On Android it always fire callback with MSG_IDFA/EVENT_NOT_SUPPORTED\n-- should be called before initialization\n```\n\n#### unityads.initialize(game_id, callback)\n#### unityads.initialize(game_id, callback, test_mode)\n\nOriginal Docs [iOS](https://unityads.unity3d.com/help/ios/api-ios#initialize) [Android](https://unityads.unity3d.com/help/android/api-android#initialize)\n```lua\nlocal function defunityads_callback(self, message_id, message)\n...\nend\n...\nunityads.initialize(\"1401815\", defunityads_callback)\n -- `test_mode` is optional parameter:\nunityads.initialize(\"1401815\", defunityads_callback, true)\n```\n\n#### unityads.set_callback(callback)\n\n```lua\nunityads.set_callback(defunityads_callback) -- set callback\nunityads.set_callback(nil) -- remove callback\nunityads.set_callback() -- remove callback\n```\n\n\n#### unityads.set_debug_mode(is_debug)\nOriginal Docs [iOS](https://unityads.unity3d.com/help/ios/api-ios#setdebugmode) [Android](https://unityads.unity3d.com/help/android/api-android#setdebugmode)\n```lua\nunityads.set_debug_mode(true) -- set debug mode\nunityads.set_debug_mode(false) -- set debug mode\n```\n\n#### unityads.get_debug_mode()\nOriginal Docs [iOS](https://unityads.unity3d.com/help/ios/api-ios#setdebugmode) [Android](https://unityads.unity3d.com/help/android/api-android#setdebugmode)\n```lua\nlocal is_debig_mode = unityads.getDebugMode() -- Returns true if current mod is debug\n```\n\n#### unityads.is_initialized()\nOriginal Docs [iOS](https://unityads.unity3d.com/help/ios/api-ios#initialize) [Android](https://unityads.unity3d.com/help/android/api-android#initialize)\n```lua\nlocal is_initialized = unityads.is_initialized() -- Returns `true` if Unity ADS initialized\n```\n\n#### unityads.is_supported()\nOriginal Docs [iOS](https://unityads.unity3d.com/help/ios/api-ios#initialize) [Android](https://unityads.unity3d.com/help/android/api-android#initialize)\n```lua\nlocal is_supported = unityads.is_supported() -- Returns `true` if Unity Ads is supported by the current device\n```\n\n#### unityads.get_version()\n```lua\nlocal version = unityads.get_version() -- Returns the Unity Ads SDK version as a string.\n```\n\n#### unityads.show(placement_id)\n```lua\nunityads.show(\"rewardedVideo\") -- show rewardedVideo\n```\n\n#### unityads.load(placement_id)\n```lua\nunityads.load(\"rewardedVideo\") -- load rewardedVideo\n```\n\n#### unityads.load_banner(placement_id)\n#### unityads.load_banner(placement_id, banner_width, banner_height)\n```lua\nunityads.load_banner(\"banner\") -- load banner, by defaulf width = 320, height = 50\nunityads.load_banner(\"banner\", 320, 50) -- load banner\n```\n\n#### unityads.unload_banner()\n```lua\nunityads.unload_banner() -- unload banner\n```\n\n#### unityads.show_banner()\n```lua\nunityads.show_banner() -- show banner\n```\n\n#### unityads.hide_banner()\n```lua\nunityads.hide_banner() -- hide banner\n```\n\n#### unityads.set_banner_position(position)\n```lua\nunityads.set_banner_position(position) -- set position of the banner\n-- default value is unityads.BANNER_POSITION_TOP_CENTER\n\n--possible positions:\nunityads.BANNER_POSITION_TOP_LEFT\nunityads.BANNER_POSITION_TOP_CENTER\nunityads.BANNER_POSITION_TOP_RIGHT\nunityads.BANNER_POSITION_BOTTOM_LEFT\nunityads.BANNER_POSITION_BOTTOM_CENTER\nunityads.BANNER_POSITION_BOTTOM_RIGHT\nunityads.BANNER_POSITION_CENTER\n```\n\n### Constants\n```lua\nlocal function defunityads_callback(self, message_id, message)\n...\nend\n```\n#### Message types\n```lua\n--possible values for `message_id` :\nunityads.MSG_INIT\nunityads.MSG_SHOW\nunityads.MSG_LOAD\nunityads.MSG_BANNER\nunityads.MSG_IDFA\n```\n##### unityads.MSG_INIT\n```lua\nlocal function defunityads_callback(self, message_id, message)\n  if message_id == unityads.MSG_INIT then\n    if message.event == unityads.EVENT_COMPLETED then\n        -- message = {placement_id = \"string\", ...}\n    elseif message.event == unityads.EVENT_SDK_ERROR then\n        -- message = {code = int, error = \"error message string\"}\n        if message.code == unityads.ERROR_INTERNAL then\n            -- initialization failed due to environment or internal services\n        elseif message.code == unityads.ERROR_INVALID_ARGUMENT then\n            -- initialization failed due to invalid argument(e.g. game ID)\n        elseif message.code == unityads.ERROR_AD_BLOCKER_DETECTED then\n            -- initialization failed due to url being blocked\n        end\n    elseif message.event == unityads.EVENT_JSON_ERROR then\n        -- message = {error = \"error message string\"}\n    end\n  end\nend\n```\n\n##### unityads.MSG_SHOW\n```lua\nlocal function defunityads_callback(self, message_id, message)\n  if message_id == unityads.MSG_SHOW then\n    if message.event == unityads.EVENT_COMPLETED then\n      -- message = {placement_id = \"string\"}\n      -- An event that indicates that the ad was played entirely.\n    elseif message.event == unityads.EVENT_SKIPPED then\n        -- message = {placement_id = \"string\"}\n        -- An event that indicates that the user skipped the ad.\n    elseif message.event == unityads.EVENT_START then\n        -- message = {placement_id = \"string\"}\n        -- UnityAds has started to show ad with a specific placement.\n    elseif message.event == unityads.EVENT_CLICKED then\n        -- message = {placement_id = \"string\"}\n        -- UnityAds has received a click while showing ad with a specific placement.\n    elseif message.event == unityads.EVENT_SDK_ERROR then\n        -- message = {code = int, error = \"error message string\", placement_id = \"string\"}\n        if message.code == unityads.ERROR_NOT_INITIALIZED then\n            -- show failed due to SDK not initialized.\n        elseif message.code == unityads.ERROR_NOT_READY then\n            --show failed due to placement not being ready.\n        elseif message.code == unityads.ERROR_VIDEO_PLAYER then\n            -- show failed due to video player.\n        elseif message.code == unityads.ERROR_INVALID_ARGUMENT then\n            -- show failed due to invalid arguments.\n        elseif message.code == unityads.ERROR_NO_CONNECTION then\n            -- show failed due to internet connection.\n        elseif message.code == unityads.ERROR_ALREADY_SHOWING then\n            -- show failed due to ad is already being showen.\n        elseif message.code == unityads.ERROR_INTERNAL then\n            -- show failed due to environment or internal services.\n        elseif message.code == unityads.ERROR_TIMEOUT then\n            -- Error related to an Ad being unable to show within a specified time frame\n        end\n    elseif message.event == unityads.EVENT_JSON_ERROR then\n        -- message = {error = \"error message string\"}\n    end\n  end\nend\n```\n\n##### unityads.MSG_LOAD\n```lua\nlocal function defunityads_callback(self, message_id, message)\n  if message.event == unityads.EVENT_LOADED then\n      -- message = {placement_id = \"string\"}\n      -- Load request has successfully filled the specified placementId with an ad that is ready to show.\n  elseif message.event == unityads.EVENT_SDK_ERROR then\n      -- message = {code = int, error = \"error message string\", placement_id = \"string\"}\n      if message.code == unityads.ERROR_NOT_INITIALIZED then\n          -- Error related to SDK not initialized\n      elseif message.code == unityads.ERROR_INTERNAL then\n          -- Error related to environment or internal services\n      elseif message.code == unityads.ERROR_INVALID_ARGUMENT then\n          -- Error related to invalid arguments\n      elseif message.code == unityads.ERROR_NO_FILL then\n          -- Error related to there being no ads available\n      elseif message.code == unityads.ERROR_TIMEOUT then\n          -- Error related to there being no ads available\n      end\n  elseif message.event == unityads.EVENT_JSON_ERROR then\n      -- message = {error = \"error message string\"}\n  end\nend\n```\n\n##### unityads.MSG_BANNER\n```lua\nlocal function defunityads_callback(self, message_id, message)\n  if message.event == unityads.EVENT_LOADED then\n      -- message = {placement_id = \"string\"}\n      -- Banner is loaded and ready to be placed in the view hierarchy.\n  elseif message.event == unityads.EVENT_LEFT_APPLICATION then\n      -- message = {placement_id = \"string\"}\n      -- Banner links outside the application.\n  elseif message.event == unityads.EVENT_CLICKED then\n      -- message = {placement_id = \"string\"}\n      -- Banner is clicked.\n  elseif message.event == unityads.EVENT_SDK_ERROR then\n      -- message = {code = int, error = \"error message string\", placement_id = \"string\"}\n      if message.code == unityads.ERROR_UNKNOWN then\n          -- Unknown error \n      elseif message.code == unityads.ERROR_NATIVE then\n          -- Error related to native\n      elseif message.code == unityads.ERROR_WEBVIEW then\n          -- Error related to webview\n      elseif message.code == unityads.ERROR_NO_FILL then\n          -- Error related to there being no ads available\n      end\n  elseif message.event == unityads.EVENT_JSON_ERROR then\n      -- message = {error = \"error message string\"}\n  end\nend\n```\n\n##### unityads.MSG_IDFA\n```lua\nlocal function defunityads_callback(self, message_id, message)\n  if message.event == unityads.EVENT_NOT_SUPPORTED then\n      -- IDFA isn't supported\n  elseif message.event == unityads.EVENT_STATUS_AUTORIZED then\n  elseif message.event == unityads.EVENT_STATUS_DENIED then\n  elseif message.event == unityads.EVENT_STATUS_NOT_DETERMINED then\n  elseif message.event == unityads.EVENT_STATUS_RESTRICTED then\n  elseif message.event == unityads.EVENT_JSON_ERROR then\n      -- message = {error = \"error message string\"}\n  end\nend\n```\n\n---\n\nIf you have any issues, questions or suggestions please [create an issue](https://github.com/AGulev/DefVideoAds/issues) or contact me: me@agulev.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAGulev%2Fdefold-extension-unity-ads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAGulev%2Fdefold-extension-unity-ads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAGulev%2Fdefold-extension-unity-ads/lists"}