Skip to content

GameFrameX/com.gameframex.unity.advertisement.csj

Repository files navigation

GameFrameX Logo

Game Frame X Advertisement (CSJ / 穿山甲)

Version License Documentation

All-in-One Solution for Indie Game Development · Empowering Indie Developers' Dreams

📖 Documentation🚀 Quick Start💬 QQ Group


🌐 Language: English | 简体中文 | 繁體中文 | 日本語 | 한국어


Project Overview

CSJ (穿山甲/Pangle) platform adapter for the Game Frame X Advertisement system. This package provides rewarded video ad integration for iOS and Android apps using ByteDance's CSJ (穿山甲) advertising SDK.

Features

  • Rewarded video ad support via CSJ (穿山甲/Pangle) SDK
  • Native iOS and Android platform support
  • IL2CPP code stripping protection
  • Conditional compilation (UNITY_IOS, UNITY_ANDROID)
  • Seamless integration with the Game Frame X Advertisement component

Architecture

This package is an adapter implementation of BaseAdvertisementManager from the Game Frame X Advertisement core. It is discovered and loaded automatically by AdvertisementComponent via Unity Inspector configuration.

Class Description
CSJAdvertisementManager Rewarded video ad manager — load, show, and lifecycle
CSJAdvertisementConfig Configuration with appId and adUnitId fields
CSJBridge Native bridge for iOS/Android platform calls
CSJNativeMessageHandler Native message callback handler
GameFrameXAdvertisementCSJCroppingHelper IL2CPP link.xml alternative — preserves type references

Quick Start

Installation

  1. Install the Advertisement core package
  2. Add this adapter via Unity Package Manager (UPM):
{
  "dependencies": {
    "com.gameframex.unity.advertisement": "https://github.com/GameFrameX/com.gameframex.unity.advertisement.git",
    "com.gameframex.unity.advertisement.csj": "https://github.com/gameframex/com.gameframex.unity.advertisement.csj.git"
  }
}

Or add via git URL in the Unity Package Manager window.

Usage

Configure in Unity Inspector: add the AdvertisementComponent to a GameObject, then select CSJAdvertisementManager from the implementation dropdown.

using GameFrameX.Advertisement.Runtime;

// Standard: via GameEntry (no dependency on com.gameframex.unity.entry)
var adComponent = GameEntry.GetComponent<AdvertisementComponent>();

// Set server-side verification data (optional)
adComponent.SetExtraData("userId", player.UserId);

// Play rewarded video ad
var option = new AdvertisementPlayOption
{
    OnSuccess    = (data) => Debug.Log("Ad shown successfully"),
    OnFail       = (err) => Debug.LogError($"Ad failed: {err}"),
    OnShowResult = (watched) =>
    {
        if (watched)
        {
            // Reward the user
        }
    },
};
adComponent.Play(option);

// Shortcut: via GameApp (requires com.gameframex.unity.entry)
GameApp.Advertisement.SetExtraData("userId", player.UserId);
var option2 = new AdvertisementPlayOption
{
    OnSuccess    = (data) => Debug.Log("Ad shown successfully"),
    OnFail       = (err) => Debug.LogError($"Ad failed: {err}"),
    OnShowResult = (watched) =>
    {
        if (watched)
        {
            // Reward the user
        }
    },
};
GameApp.Advertisement.Play(option2);

Platform Support

Platform Supported
iOS Yes
Android Yes
WebGL No
Standalone No

Requires UNITY_IOS or UNITY_ANDROID scripting define symbols.

Documentation & Resources

Community & Support

Changelog

v1.0.0

  • Initial release
  • Rewarded video ad support for CSJ (穿山甲/Pangle) platform
  • IL2CPP cropping protection

License

This project is licensed under the MIT License and Apache License 2.0.

About

CSJ (穿山甲/Pangle) advertisement adapter for Game Frame X — rewarded video ads for iOS/Android Unity games with native bridge and IL2CPP protection

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors