Cocos Creator exports to the web through two built-in templates: Web Desktop and Web Mobile. For Wavedash, always use Web Mobile — the Desktop template is locked to a fixed-size container and will not resize to fit the Wavedash iframe.
Pick the right build template
Build for Web Mobile, not Web Desktop. The Desktop template locks the game to a fixed-size #GameDiv (with cc_exact_fit_screen="false") and ignores window.resize, so the canvas never fills the Wavedash iframe regardless of CSS. Web Mobile sets exactFitScreen: true and binds to the window — that's what you want.
In the Cocos Creator build panel:
- Build → New Build Task
- Platform: Web Mobile
- Output directory: leave as
build/web-mobile - Build
This produces a build/web-mobile/ folder with index.html plus the Cocos runtime and your assets. Point upload_dir at that folder.
SDK integration
Call the JavaScript SDK from any Cocos component. A common place is the start() lifecycle hook on your root scene component — by the time it runs, the scene is loaded and visible, so it's a good point to signal load-complete to Wavedash.
Calling Wavedash.init() is required. Your game stays hidden behind the Wavedash loading screen until you do. Call it once your game is ready to play.
import { _decorator, Component } from 'cc';
const { ccclass } = _decorator;
declare global {
interface Window {
Wavedash: any;
}
}
@ccclass('Game')
export class Game extends Component {
start() {
try {
const Wavedash = window.Wavedash;
if (Wavedash) {
Wavedash.updateLoadProgressZeroToOne(1.0);
Wavedash.init({ debug: true });
}
} catch (e) {
console.warn('[wavedash] init failed:', e);
}
}
}
Any SDK call works the same way — Wavedash.setAchievement("first_win", true), Wavedash.requestStats(), and so on. See the Functions reference for the full list.
wavedash.toml
game_id = "YOUR_GAME_ID_HERE"
upload_dir = "./build/web-mobile"
entrypoint = "index.html"
The Cocos build/ directory is a compiler output and usually isn't committed to source control. Build from Cocos Creator once before running wavedash dev or wavedash build push.