패키지, 저장소 및 앱 카테고리 검색

unity_ads_plugin 표지
패키지 상세v0.5.0

unity_ads_plugin

Flutter 애플리케이션용 Unity Ads 플러그인입니다. 이 플러그인은 Unity 배너 광고 및 Unity 비디오 광고를 표시할 수 있습니다.

AndroidiOS
30일 다운로드
5.8천
좋아요
176
Pub 점수
160

패키지 설치

flutter pub add unity_ads_plugin

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

unity_ads_plugin은 Flutter 애플리케이션에서 Unity 광고를 통합할 수 있도록 하며, 안드로이드 및 iOS에서 배너 및 비디오 광고 형식을 지원합니다. 앱 내에서 광고를 로드하고 표시하기 위한 간단한 인터페이스를 제공하여 개발자가 Unity의 광고 플랫폼을 통해 프로젝트를 수익화할 수 있도록 도와줍니다. 이 플러그인은 Flutter의 네이티브 통합 기능과 원활하게 작동하도록 설계되어, 깊이 있는 플랫폼별 지식 없이도 부드럽게 광고 렌더링이 가능합니다. 최소한의 설정으로 신뢰할 수 있는 앱 내 광고 솔루션을 찾는 앱에 이상적입니다.

사용 사례

  • 모바일 게임 수익화
  • 앱에서 배너 광고 표시하기
  • 보상형 비디오 광고 실행
  • 유니티 광고 네트워크 통합
  • 앱 내 광고를 통한 앱 수익 증대

주요 기능

  • Unity 배너 광고 지원
  • Unity 비디오 광고 지원
  • 크로스 플랫폼(안드로이드 및 iOS)
  • Flutter와의 간단한 통합
  • 실시간 광고 로딩 및 표시

적합한 대상

  • Unity Ads를 사용하는 Flutter 개발자
  • 수익화를 찾는 모바일 게임 개발자
  • 보상형 비디오 광고가 필요한 앱
  • Android 및 iOS를 대상으로 하는 개발자
  • 경량 광고 통합이 필요한 프로젝트

고려 사항

  • Unity Ads 계정 설정이 필요합니다
  • Unity Ads SDK 버전에 따라 다릅니다
  • 안드로이드에서 추가 권한이 필요할 수 있습니다
  • 광고 이용 가능 여부는 지역 및 재고에 따라 다릅니다
  • 광고 로딩 지연으로 인한 성능 영향

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Unity Ads Plugin

Pub License Pub likes Monthly downloads Pub points Flutter platform

Buy Me A Coffee PayPal

📢 Follow for updates: t.me/pavelzaichyk_dev

A Flutter plugin for integrating Unity Ads into your mobile applications. Easily display Unity Banner Ads and Unity Video Ads (Rewarded & Interstitial) with simple Dart APIs.


Features

  • Display Unity Banner, Rewarded, and Interstitial Video Ads
  • Simple initialization and ad loading
  • Server-to-server reward callback support
  • Privacy consent management
  • Firebase Test Lab support (Android)
  • Null safety

Table of Contents


Installation

Add the plugin to your pubspec.yaml:

dependencies:
  unity_ads_plugin: ^<latest_version>

Then run:

flutter pub get

Usage Example

Here is a minimal example of using the plugin:

import 'package:unity_ads_plugin/unity_ads_plugin.dart';

void main() {
  UnityAds.init(
    gameId: 'YOUR_GAME_ID',
    testMode: true,
    onComplete: () => print('Unity Ads Initialized'),
    onFailed: (error, message) => print('Unity Ads Initialization Failed: $error $message'),
  );
}

For more detailed usage, see the Getting Started section.


Getting Started

1. Initialization
UnityAds.init(
  gameId: 'PROJECT_GAME_ID',
  onComplete: () => print('Initialization Complete'),
  onFailed: (error, message) => print('Initialization Failed: $error $message'),
);

Set your Game ID. For testing purposes, set testMode to true.

UnityAds.isInitialized() can be used to check if the SDK has initialized successfully.


Android only: To change ad behavior in Firebase Test Lab, use the firebaseTestLabMode parameter. Possible values:

Mode Description
disableAds Ads are not displayed in Firebase Test Lab (default)
showAdsInTestMode Ads are displayed in test mode.
showAds Real ads are displayed if testMode is false.
2. Show Rewarded/Interstitial Video Ad

Rewarded Video Ad Interstitial Video Ad

Load a video ad before showing it.

UnityAds.load(
  placementId: 'PLACEMENT_ID',
  onComplete: (placementId) => print('Load Complete $placementId'),
  onFailed: (placementId, error, message) => print('Load Failed $placementId: $error $message'),
);

Show a loaded ad.

UnityAds.showVideoAd(
  placementId: 'PLACEMENT_ID',
  onStart: (placementId) => print('Video Ad $placementId started'),
  onClick: (placementId) => print('Video Ad $placementId click'),
  onSkipped: (placementId) => print('Video Ad $placementId skipped'),
  onComplete: (placementId) => print('Video Ad $placementId completed'),
  onFailed: (placementId, error, message) => print('Video Ad $placementId failed: $error $message'),
);
Server-to-server Redeem Callbacks

UnityAds.showVideoAd has a serverId parameter. To use server-to-server callbacks, set this parameter. Read more at docs.unity.com.

3. Show Banner Ad

Banner Ad

Place the UnityBannerAd widget in your app.

UnityBannerAd(
  placementId: 'PLACEMENT_ID',
  onLoad: (placementId) => print('Banner loaded: $placementId'),
  onClick: (placementId) => print('Banner clicked: $placementId'),
  onShown: (placementId) => print('Banner shown: $placementId'),
  onFailed: (placementId, error, message) => print('Banner Ad $placementId failed: $error $message'),
)
Privacy Consent

Read more about privacy consent in the Unity Ads documentation.

Use the following code to pass the appropriate consent flags to the Unity Ads SDK:

UnityAds.setPrivacyConsent(<Privacy Consent type>, true)

Troubleshooting

Android: the ad shows up as a separate app in Recent Apps

Symptom. While a fullscreen ad is playing, Recent Apps shows two cards for your app — your app and the ad. Users can swipe the ad away before it completes, so the impression is lost.

Fix. Remove one line from your app's android/app/src/main/AndroidManifest.xml:

<activity
    android:name=".MainActivity"
    android:taskAffinity=""     <!-- remove this line -->
    ...>

Flutter's template adds that blank affinity; Unity's ad screen keeps the default one. Android puts screens with different affinities in different tasks — hence the second card. Removing it puts the ad back in your app's task.

Trade-off. The attribute guards against task hijacking (flutter#144018), which Android patches at the OS level from API 30. On minSdk 30+ removing it costs nothing; below that, users on Android 7–10 lose partial protection — raising minSdk to 30 fixes both concerns at once.

Adding excludeFromRecents to Unity's ad activity does not work as an alternative. See issue #70.


Donate

If you find this package helpful and would like to support its continued development, please consider making a donation. Your contributions are greatly appreciated and motivate the further enhancement of this and other plugins.

Donate Buy Me A Coffee PayPal

Your support helps maintain and improve this package, ensuring it remains up-to-date and useful for the community.

Thank you for your generosity!

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트