A tiny issue with the Unity ads extension

Hi! I tried out the Unity ads extension. It works fine but when a rewarded video finished playing the code in the callback wasn’t executed . Here’s the callback

local function unity_ads_callback(self, msg_type, message)
if msg_type == unityads.TYPE_IS_READY then
	print(message.placementId, " is ready")
	--btn_ready(self, message.placementId)
elseif msg_type == unityads.TYPE_DID_START then
	print(message.placementId, " started")
elseif msg_type == unityads.TYPE_DID_ERROR then
	print(message.message)
	-- errors info https://github.com/Unity-Technologies/unity-ads-ios/wiki/sdk_ios_api_errors
	if message.error == unityads.ERROR_NOT_INITIALIZED then
		print("kUnityAdsErrorNotInitialized")
	elseif message.error == unityads.ERROR_INITIALIZED_FAILED then
		print("kUnityAdsErrorInitializedFailed")
	elseif message.error == unityads.ERROR_INVALID_ARGUMENT then
		print("kUnityAdsErrorInvalidArgument")
	elseif message.error == unityads.ERROR_VIDEO_PLAYER then
		print("kUnityAdsErrorVideoPlayerError")
	elseif message.error == unityads.ERROR_INIT_SANITY_CHECK_FAIL then
		print("kUnityAdsErrorInitSanityCheckFail")
	elseif message.error == unityads.ERROR_AD_BLOCKER_DETECTED then
		print("kUnityAdsErrorAdBlockerDetected")
	elseif message.error == unityads.ERROR_FILE_IO then
		print("kUnityAdsErrorFileIoError")
	elseif message.error == unityads.ERROR_DEVICE_ID then
		print("kUnityAdsErrorDeviceIdError")
	elseif message.error == unityads.ERROR_SHOW then
		print("kUnityAdsErrorShowError")
	elseif message.error == unityads.ERROR_INTERNAL then
		print("kUnityAdsErrorInternalError")
	end
elseif msg_type == unityads.TYPE_DID_FINISH then
	--all finish states info https://github.com/Unity-Technologies/unity-ads-ios/wiki/sdk_ios_api_finishstates
	if message.state == unityads.FINISH_STATE_ERROR then
		print("kUnityAdsFinishStateError")
	elseif message.state == unityads.FINISH_STATE_SKIPPED then
		print("kUnityAdsFinishStateSkipped")
	elseif message.state == unityads.FINISH_STATE_COMPLETED then
		print("kUnityAdsFinishStateCompleted")
		msg.post(sender, "completed")
	end
end

What did I miss?

1 Like

Not sure. @AGulev (author of the extension) is on vacation but should be back on Monday I think.

1 Like

You should set a callback in ‘unityads.initialize(gameID, callback)’ or in ‘unityads.setCallback(callback)’ if you reload game directly from the editor using your phone as a target

2 Likes