Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat: add custom template support for build emitters

esenginef5f25e5c283a
diff --git a/editor/src/builder/BuildSettingsDialog.ts b/editor/src/builder/BuildSettingsDialog.ts
index f4b4c1073..e273b0edf 100644
--- a/editor/src/builder/BuildSettingsDialog.ts
+++ b/editor/src/builder/BuildSettingsDialog.ts
@@ -29,6 +29,8 @@ import { formatSize } from './BuildProgress';
import { discoverProjectScenes } from './SceneDiscovery';
import { createDefaultHook } from './BuildHooks';
import type { BuildHook, BuildHookPhase, BuildHookType, CopyFilesConfig, RunCommandConfig } from '../types/BuildTypes';
+import { getDefaultTemplate, getTemplateRelPath, getTemplatePlaceholderDocs } from './templates';
+import { joinPath, getParentDir } from '../utils/path';
// =============================================================================
// Types
@@ -540,6 +542,7 @@ export class BuildSettingsDialog {
value="${s.ctaUrl || ''}" placeholder="https://play.google.com/store/apps/...">
</div>
` : ''}
+ ${this.renderTemplateSection('playable', s.templatePath)}
`;
} else if (config.platform === 'wechat' && config.wechatSettings) {
const s = config.wechatSettings;
@@ -574,6 +577,7 @@ export class BuildSettingsDialog {
<button class="es-btn" data-action="browse-output">...</button>
</div>
</div>
+ ${this.renderTemplateSection('wechat', s.templatePath)}
`;
}
@@ -592,6 +596,40 @@ export class BuildSettingsDialog {
`;
}
+ private renderTemplateSection(platform: BuildPlatform, templatePath?: string): string {
+ const defaultRelPath = getTemplateRelPath(platform);
+ const placeholders = getTemplatePlaceholderDocs(platform);
+ const sectionKey = `template-ref-${platform}`;
+ const isRefExpanded = this.expandedSections_.has(sectionKey);
+ const placeholderRows = placeholders.map(p =>
+ `<tr><td style="font-family:monospace;white-space:nowrap;padding:2px 8px 2px 0">{{${p.key}}}</td><td style="padding:2px 0">${p.description}</td></tr>`
+ ).join('');
+
+ return `
+ <div class="es-build-field" style="margin-top:8px;padding-top:8px;border-top:1px solid var(--border)">
+ <label class="es-build-label">Custom Template</label>
+ <div class="es-build-path-row">
+ <input type="text" class="es-input" id="${platform}-template-path"
+ value="${templatePath || ''}" placeholder="${defaultRelPath}">
+ </div>
+ <div style="display:flex;gap:4px;margin-top:4px">
+ <button class="es-btn es-btn-small" data-action="export-template" data-platform="${platform}">Export Default</button>
+ <button class="es-btn es-btn-small" data-action="open-template" data-platform="${platform}">Open</button>
+ <button class="es-btn es-btn-small" data-action="reset-template" data-platform="${platform}">Reset</button>
+ </div>
+ </div>
+ <div class="es-build-collapse ${isRefExpanded ? 'es-expanded' : ''}" data-section="${sectionKey}" style="margin-top:4px">
+ <div class="es-build-collapse-header">
+ ${isRefExpanded ? icons.chevronDown(12) : icons.chevronRight(12)}
+ <span>Placeholders Reference</span>
+ </div>
+ <div style="display:${isRefExpanded ? 'block' : 'none'};padding:8px;font-size:11px" data-template-ref-content="${platform}">
+ <table style="width:100%">${placeholderRows}</table>
+ </div>
+ </div>
+ `;
+ }
+
private renderEngineModulesSection(config: BuildConfig): string {
const isExpanded = this.expandedSections_.has('engine-modules');
const modules = config.engineModules ?? createDefaultEngineModules();
@@ -764,11 +802,15 @@ export class BuildSettingsDialog {
this.expandedSections_.add(section);
collapse.classList.add('es-expanded');
}
+ const expanded = this.expandedSections_.has(section);
const chevron = collapseHeader.querySelector('svg');
if (chevron) {
- const expanded = this.expandedSections_.has(section);
chevron.outerHTML = expanded ? icons.chevronDown(12) : icons.chevronRight(12);
}
+ const inlineContent = collapse.querySelector('[data-template-ref-content]') as HTMLElement;
+ if (inlineContent) {
+ inlineContent.style.display = expanded ? 'block' : 'none';
+ }
}
return;
}
@@ -1033,6 +1075,30 @@ export class BuildSettingsDialog {
fs?.openFolder(this.toolchainStatus_.emsdk_path);
}
break;
+
+ case 'export-template': {
+ const platform = element.dataset.platform as BuildPlatform;
+ if (platform) {
+ await this.handleExportTemplate(platform);
+ }
+ break;
+ }
+
+ case 'open-template': {
+ const platform = element.dataset.platform as BuildPlatform;
+ if (platform && config) {
+ await this.handleOpenTemplate(platform, config);
+ }
+ break;
+ }
+
+ case 'reset-template': {
+ const platform = element.dataset.platform as BuildPlatform;
+ if (platform && config) {
+ await this.handleResetTemplate(platform, config);
+ }
+ break;
+ }
}
}
@@ -1076,6 +1142,8 @@ export class BuildSettingsDialog {
this.render();
} else if (id === 'playable-cta-url') {
config.playableSettings.ctaUrl = target.value;
+ } else if (id === 'playable-template-path') {
+ config.playableSettings.templatePath = target.value || undefined;
}
}
@@ -1090,6 +1158,8 @@ export class BuildSettingsDialog {
config.wechatSettings.bundleMode = target.value as 'subpackage' | 'single' | 'singleFile';
} else if (id === 'wechat-output') {
config.wechatSettings.outputDir = target.value;
+ } else if (id === 'wechat-template-path') {
+ config.wechatSettings.templatePath = target.value || undefined;
}
}
@@ -1660,6 +1730,71 @@ export class BuildSettingsDialog {
}
}
+ // =========================================================================
+ // Template Management
+ // =========================================================================
+
+ private async handleExportTemplate(platform: BuildPlatform): Promise<void> {
+ const fs = getEditorContext().fs;
+ if (!fs) return;
+
+ const projectDir = this.getProjectDir();
+ const relPath = getTemplateRelPath(platform);
+ const absPath = joinPath(projectDir, relPath);
+
+ if (await fs.exists(absPath)) {
+ showToast({ title: `Template already exists: ${relPath}`, type: 'info' });
+ return;
+ }
+
+ await fs.createDirectory(getParentDir(absPath));
+ const ok = await fs.writeFile(absPath, getDefaultTemplate(platform));
+ if (ok) {
+ showSuccessToast(`Exported to ${relPath}`);
+ } else {
+ showErrorToast('Failed to export template');
+ }
+ }
+
+ private async handleOpenTemplate(platform: BuildPlatform, config: BuildConfig): Promise<void> {
+ const fs = getEditorContext().fs;
+ if (!fs) return;
+
+ const projectDir = this.getProjectDir();
+ const customPath = platform === 'playable'
+ ? config.playableSettings?.templatePath
+ : config.wechatSettings?.templatePath;
+ const relPath = customPath || getTemplateRelPath(platform);
+ const absPath = joinPath(projectDir, relPath);
+
+ if (!await fs.exists(absPath)) {
+ showToast({ title: `Template not found: ${relPath}. Export it first.`, type: 'info' });
+ return;
+ }
+
+ await fs.openFolder(getParentDir(absPath));
+ }
+
+ private async handleResetTemplate(platform: BuildPlatform, config: BuildConfig): Promise<void> {
+ const fs = getEditorContext().fs;
+ if (!fs) return;
+
+ const projectDir = this.getProjectDir();
+ const absPath = joinPath(projectDir, getTemplateRelPath(platform));
+
+ await fs.removeFile(absPath);
+
+ if (platform === 'playable' && config.playableSettings) {
+ config.playableSettings.templatePath = undefined;
+ } else if (platform === 'wechat' && config.wechatSettings) {
+ config.wechatSettings.templatePath = undefined;
+ }
+
+ await this.saveSettings();
+ this.render();
+ showSuccessToast('Template reset to default');
+ }
+
// =========================================================================
// Scene Management
// =========================================================================
diff --git a/editor/src/builder/PlayableEmitter.ts b/editor/src/builder/PlayableEmitter.ts
index 9f5ecdefb..409d1567b 100644
--- a/editor/src/builder/PlayableEmitter.ts
+++ b/editor/src/builder/PlayableEmitter.ts
@@ -10,7 +10,7 @@ import { BuildProgressReporter } from './BuildProgress';
import { getEditorContext } from '../context/EditorContext';
import { joinPath, getFileExtension, isAbsolutePath, getParentDir, normalizePath, getProjectDir } from '../utils/path';
import { arrayBufferToBase64, generateAddressableManifest, generateCatalog } from './ArtifactBuilder';
-import { PLAYABLE_HTML_TEMPLATE } from './templates';
+import { renderTemplate, loadTemplate } from './templates';
import type { NativeFS } from '../types/NativeFS';
import { getAssetMimeType, getAssetTypeEntry, toBuildPath } from 'esengine';
import {
@@ -21,6 +21,7 @@ import {
generatePhysicsConfig,
} from './EmitterUtils';
+
// =============================================================================
// PlayableEmitter
// =============================================================================
@@ -122,14 +123,16 @@ export class PlayableEmitter implements PlatformEmitter {
const catalogJson = JSON.stringify(generateCatalog(artifact));
assets.set('catalog.json', `data:application/json;base64,${btoa(catalogJson)}`);
- // 7. Assemble HTML
+ // 7. Load template + assemble HTML
progress.setCurrentTask('Assembling HTML...', 50);
- const html = this.assembleHTML(
+ const template = await loadTemplate(fs, projectDir, context.config.playableSettings?.templatePath, 'playable');
+ const sections = this.prepareSections(
wasmSdk, gameCode, allScenes, startupSceneName, assets,
spineModules,
physicsJsSource, physicsWasmBase64,
context, manifestJson
);
+ const html = renderTemplate(template, sections);
progress.log('info', `HTML assembled: ${html.length} bytes`);
// 8. Write output
@@ -314,14 +317,14 @@ const __plugins = [${pluginList}];
await scan(assetsDir, 'assets');
}
- private assembleHTML(
+ private prepareSections(
wasmSdk: string, gameCode: string,
allScenes: Array<{ name: string; data: string }>, startupScene: string,
assets: Map<string, string>,
spineModules: Array<{ version: string; js: string; wasmBase64: string }>,
physicsJs: string, physicsWasmBase64: string,
context: BuildContext, manifestJson: string
- ): string {
+ ): Record<string, string> {
const entries: string[] = [];
for (const [path, dataUrl] of assets) {
entries.push(`"${path}":"${dataUrl}"`);
@@ -346,46 +349,36 @@ const __plugins = [${pluginList}];
physicsScript = `<script>\nvar __PHYSICS_WASM_B64__="${physicsWasmBase64}";\n${physicsJs}\n</script>`;
}
- const physicsConfig = generatePhysicsConfig(context);
-
const enableCTA = context.config.playableSettings?.enableBuiltinCTA ?? false;
const ctaUrl = JSON.stringify(context.config.playableSettings?.ctaUrl || '');
- const ctaStyle = enableCTA
- ? '#cta{position:fixed;bottom:5%;left:50%;transform:translateX(-50%);padding:12px 32px;font-size:18px;font-weight:bold;color:#fff;background:#ff4444;border:none;border-radius:8px;cursor:pointer;z-index:999;text-transform:uppercase;box-shadow:0 2px 8px rgba(0,0,0,0.3)}\n#cta:active{transform:translateX(-50%) scale(0.95)}'
- : '';
- const ctaHtml = enableCTA
- ? '<button id="cta" style="display:none">Install Now</button>'
- : '';
- const ctaScript = enableCTA
- ? `function installCTA(){\n if(typeof mraid!=='undefined'&&mraid.open){mraid.open(${ctaUrl})}\n else{window.open(${ctaUrl},'_blank')}\n}\ndocument.getElementById('cta').addEventListener('click',installCTA);`
- : '';
- const ctaShow = enableCTA
- ? "document.getElementById('cta').style.display='block';"
- : '';
-
- const runtimeConfigCode = this.generateRuntimeConfigCode(context);
- const runtimeAppConfigCode = this.generateRuntimeAppConfigCode(context);
-
- return PLAYABLE_HTML_TEMPLATE
- .replace('{{WASM_SDK}}', () => wasmSdk)
- .replace('{{SPINE_SCRIPT}}', () => spineScript)
- .replace('{{PHYSICS_SCRIPT}}', () => physicsScript)
- .replace('{{GAME_CODE}}', () => gameCode)
- .replace('{{ASSETS_MAP}}', () => `{${entries.join(',')}}`)
- .replace('{{SCENES_DATA}}', () => {
- const items = allScenes.map(s => `{name:${JSON.stringify(s.name)},data:${s.data}}`);
- return `[${items.join(',')}]`;
- })
- .replace('{{STARTUP_SCENE}}', () => startupScene)
- .replace('{{PHYSICS_CONFIG}}', () => physicsConfig)
- .replace('{{MANIFEST}}', () => manifestJson)
- .replace('{{RUNTIME_CONFIG}}', () => runtimeConfigCode)
- .replace('{{RUNTIME_APP_CONFIG}}', () => runtimeAppConfigCode)
- .replace('{{CTA_STYLE}}', () => ctaStyle)
- .replace('{{CTA_HTML}}', () => ctaHtml)
- .replace('{{CTA_SCRIPT}}', () => ctaScript)
- .replace('{{CTA_SHOW}}', () => ctaShow);
+ const sceneItems = allScenes.map(s => `{name:${JSON.stringify(s.name)},data:${s.data}}`);
+
+ return {
+ WASM_SDK: wasmSdk,
+ SPINE_SCRIPT: spineScript,
+ PHYSICS_SCRIPT: physicsScript,
+ GAME_CODE: gameCode,
+ ASSETS_MAP: `{${entries.join(',')}}`,
+ SCENES_DATA: `[${sceneItems.join(',')}]`,
+ STARTUP_SCENE: startupScene,
+ PHYSICS_CONFIG: generatePhysicsConfig(context),
+ MANIFEST: manifestJson,
+ RUNTIME_CONFIG: this.generateRuntimeConfigCode(context),
+ RUNTIME_APP_CONFIG: this.generateRuntimeAppConfigCode(context),
+ CTA_STYLE: enableCTA
+ ? '#cta{position:fixed;bottom:5%;left:50%;transform:translateX(-50%);padding:12px 32px;font-size:18px;font-weight:bold;color:#fff;background:#ff4444;border:none;border-radius:8px;cursor:pointer;z-index:999;text-transform:uppercase;box-shadow:0 2px 8px rgba(0,0,0,0.3)}\n#cta:active{transform:translateX(-50%) scale(0.95)}'
+ : '',
+ CTA_HTML: enableCTA
+ ? '<button id="cta" style="display:none">Install Now</button>'
+ : '',
+ CTA_SCRIPT: enableCTA
+ ? `function installCTA(){\n if(typeof mraid!=='undefined'&&mraid.open){mraid.open(${ctaUrl})}\n else{window.open(${ctaUrl},'_blank')}\n}\ndocument.getElementById('cta').addEventListener('click',installCTA);`
+ : '',
+ CTA_SHOW: enableCTA
+ ? "document.getElementById('cta').style.display='block';"
+ : '',
+ };
}
private generateRuntimeConfigCode(context: BuildContext): string {
diff --git a/editor/src/builder/WeChatEmitter.ts b/editor/src/builder/WeChatEmitter.ts
index b24f478b6..1aea15654 100644
--- a/editor/src/builder/WeChatEmitter.ts
+++ b/editor/src/builder/WeChatEmitter.ts
@@ -11,7 +11,7 @@ import { getEditorContext } from '../context/EditorContext';
import { joinPath, getProjectDir } from '../utils/path';
import { resolveShaderPath } from '../utils/shader';
import { generateAddressableManifest, generateCatalog } from './ArtifactBuilder';
-import { generateWeChatGameJs } from './templates';
+import { prepareWeChatSections, renderTemplate, loadTemplate } from './templates';
import type { NativeFS } from '../types/NativeFS';
import { getWeChatPackOptions, getAssetTypeEntry, toBuildPath } from 'esengine';
import {
@@ -20,6 +20,7 @@ import {
generatePhysicsConfig,
} from './EmitterUtils';
+
// =============================================================================
// WeChatEmitter
// =============================================================================
@@ -242,7 +243,7 @@ export class WeChatEmitter implements PlatformEmitter {
const physicsConfig = generatePhysicsConfig(context);
const spineEnabled = context.config.engineModules?.spine !== false;
- const gameJs = generateWeChatGameJs({
+ const sections = prepareWeChatSections({
userCode,
firstSceneName,
allSceneNames,
@@ -252,6 +253,9 @@ export class WeChatEmitter implements PlatformEmitter {
runtimeConfig: context.runtimeConfig,
});
+ const template = await loadTemplate(fs, projectDir, context.config.wechatSettings?.templatePath, 'wechat');
+ const gameJs = renderTemplate(template, sections);
+
await fs.writeFile(joinPath(outputDir, 'game.js'), gameJs);
await this.copyWeChatSdk(fs, outputDir, context, artifact);
}
diff --git a/editor/src/builder/templates.ts b/editor/src/builder/templates.ts
index 74b7ce183..1f73b16a3 100644
--- a/editor/src/builder/templates.ts
+++ b/editor/src/builder/templates.ts
@@ -4,6 +4,9 @@
*/
import type { RuntimeBuildConfig } from './BuildService';
+import type { BuildPlatform } from '../types/BuildTypes';
+import type { NativeFS } from '../types/NativeFS';
+import { joinPath, isAbsolutePath, normalizePath } from '../utils/path';
// =============================================================================
// Playable HTML Template
@@ -76,6 +79,29 @@ window.fetch=function(u,o){var d=typeof u==='string'&&__PA__[u];return d?_fetch.
// WeChat game.js Template
// =============================================================================
+export const WECHAT_GAMEJS_TEMPLATE = `var ESEngineModule = require('./esengine.js');
+var SDK = require('./sdk.js');
+globalThis.__esengine_sdk = SDK;
+
+{{USER_CODE}}
+
+(async function() {
+ try {
+ await SDK.initWeChatRuntime({
+ engineFactory: ESEngineModule,
+ sceneNames: {{SCENE_NAMES}},
+ firstScene: {{FIRST_SCENE}},
+ runtimeConfig: {{RUNTIME_CONFIG}},
+ physicsConfig: {{PHYSICS_CONFIG}},
+ {{SPINE_FACTORIES}}
+ {{PHYSICS_FACTORY}}
+ });
+ } catch (err) {
+ console.error('[ESEngine] Runtime init error:', err);
+ }
+})();
+`;
+
export interface WeChatGameJsParams {
userCode: string;
firstSceneName: string;
@@ -86,11 +112,9 @@ export interface WeChatGameJsParams {
runtimeConfig?: RuntimeBuildConfig;
}
-export function generateWeChatGameJs(params: WeChatGameJsParams): string {
+export function prepareWeChatSections(params: WeChatGameJsParams): Record<string, string> {
const { userCode, firstSceneName, allSceneNames, spineVersions, hasPhysics, physicsConfig, runtimeConfig } = params;
- const runtimeConfigJson = runtimeConfig ? JSON.stringify(runtimeConfig) : 'undefined';
-
const nonNativeVersions = spineVersions.filter(v => v !== '4.2');
let spineFactoriesCode = '';
if (nonNativeVersions.length > 0) {
@@ -101,27 +125,112 @@ export function generateWeChatGameJs(params: WeChatGameJsParams): string {
spineFactoriesCode = `spineFactories: {${entries.join(', ')}},`;
}
- return `
-var ESEngineModule = require('./esengine.js');
-var SDK = require('./sdk.js');
-globalThis.__esengine_sdk = SDK;
+ return {
+ USER_CODE: userCode,
+ SCENE_NAMES: JSON.stringify(allSceneNames),
+ FIRST_SCENE: JSON.stringify(firstSceneName),
+ RUNTIME_CONFIG: runtimeConfig ? JSON.stringify(runtimeConfig) : 'undefined',
+ PHYSICS_CONFIG: physicsConfig,
+ SPINE_FACTORIES: spineFactoriesCode,
+ PHYSICS_FACTORY: hasPhysics ? "physicsFactory: require('./physics.js')," : '',
+ };
+}
-${userCode}
+export function generateWeChatGameJs(params: WeChatGameJsParams): string {
+ const sections = prepareWeChatSections(params);
+ return renderTemplate(WECHAT_GAMEJS_TEMPLATE, sections);
+}
-(async function() {
- try {
- await SDK.initWeChatRuntime({
- engineFactory: ESEngineModule,
- sceneNames: ${JSON.stringify(allSceneNames)},
- firstScene: ${JSON.stringify(firstSceneName)},
- runtimeConfig: ${runtimeConfigJson},
- physicsConfig: ${physicsConfig},
- ${spineFactoriesCode}
- ${hasPhysics ? "physicsFactory: require('./physics.js')," : ''}
- });
- } catch (err) {
- console.error('[ESEngine] Runtime init error:', err);
+// =============================================================================
+// Shared template rendering
+// =============================================================================
+
+export function renderTemplate(template: string, sections: Record<string, string>): string {
+ return template.replace(/\{\{(\w+)\}\}/g, (match, key) =>
+ key in sections ? sections[key] : match
+ );
+}
+
+// =============================================================================
+// Shared template loading (3-level fallback)
+// =============================================================================
+
+export async function loadTemplate(
+ fs: NativeFS,
+ projectDir: string,
+ customPath: string | undefined,
+ platform: BuildPlatform,
+): Promise<string> {
+ if (customPath) {
+ const absPath = isAbsolutePath(customPath)
+ ? normalizePath(customPath)
+ : joinPath(projectDir, customPath);
+ const content = await fs.readFile(absPath);
+ if (content) return content;
}
-})();
-`;
+
+ const projectTemplatePath = joinPath(projectDir, TEMPLATE_REL_PATHS[platform]);
+ const content = await fs.readFile(projectTemplatePath);
+ if (content) return content;
+
+ return DEFAULT_TEMPLATES[platform];
+}
+
+// =============================================================================
+// Template export utilities
+// =============================================================================
+
+const TEMPLATE_REL_PATHS: Record<BuildPlatform, string> = {
+ playable: '.esengine/templates/playable.html',
+ wechat: '.esengine/templates/wechat-game.js',
+};
+
+const DEFAULT_TEMPLATES: Record<BuildPlatform, string> = {
+ playable: PLAYABLE_HTML_TEMPLATE,
+ wechat: WECHAT_GAMEJS_TEMPLATE,
+};
+
+export function getTemplateRelPath(platform: BuildPlatform): string {
+ return TEMPLATE_REL_PATHS[platform];
+}
+
+export function getDefaultTemplate(platform: BuildPlatform): string {
+ return DEFAULT_TEMPLATES[platform];
+}
+
+export interface PlaceholderDoc {
+ key: string;
+ description: string;
+}
+
+const PLAYABLE_PLACEHOLDER_DOCS: PlaceholderDoc[] = [
+ { key: 'WASM_SDK', description: 'Compiled WASM engine JS module' },
+ { key: 'SPINE_SCRIPT', description: 'Spine animation module <script> tags' },
+ { key: 'PHYSICS_SCRIPT', description: 'Physics module <script> tag' },
+ { key: 'GAME_CODE', description: 'Compiled user scripts (IIFE)' },
+ { key: 'ASSETS_MAP', description: 'JS object mapping asset paths to data URIs' },
+ { key: 'SCENES_DATA', description: 'Array of scene JSON objects' },
+ { key: 'STARTUP_SCENE', description: 'Name of the first scene to load' },
+ { key: 'PHYSICS_CONFIG', description: 'Physics configuration JSON' },
+ { key: 'MANIFEST', description: 'Addressable asset manifest JSON' },
+ { key: 'RUNTIME_CONFIG', description: 'RuntimeConfig property assignments' },
+ { key: 'RUNTIME_APP_CONFIG', description: 'App-level config calls (maxDeltaTime, etc.)' },
+ { key: 'CTA_STYLE', description: 'CSS for built-in CTA button' },
+ { key: 'CTA_HTML', description: 'HTML for built-in CTA button element' },
+ { key: 'CTA_SCRIPT', description: 'JS click handler for CTA button' },
+ { key: 'CTA_SHOW', description: 'JS to show CTA button after init' },
+];
+
+const WECHAT_PLACEHOLDER_DOCS: PlaceholderDoc[] = [
+ { key: 'USER_CODE', description: 'Compiled user scripts' },
+ { key: 'SCENE_NAMES', description: 'JSON array of scene names' },
+ { key: 'FIRST_SCENE', description: 'JSON string of first scene name' },
+ { key: 'RUNTIME_CONFIG', description: 'Runtime config JSON object' },
+ { key: 'PHYSICS_CONFIG', description: 'Physics config JSON string' },
+ { key: 'SPINE_FACTORIES', description: 'Spine factory require() entries' },
+ { key: 'PHYSICS_FACTORY', description: 'Physics factory require() entry' },
+];
+
+export function getTemplatePlaceholderDocs(platform: BuildPlatform): PlaceholderDoc[] {
+ return platform === 'playable' ? PLAYABLE_PLACEHOLDER_DOCS : WECHAT_PLACEHOLDER_DOCS;
}
diff --git a/editor/src/types/BuildTypes.ts b/editor/src/types/BuildTypes.ts
index 87c0b96fd..4c47dc68c 100644
--- a/editor/src/types/BuildTypes.ts
+++ b/editor/src/types/BuildTypes.ts
@@ -32,6 +32,7 @@ export interface PlayableSettings {
outputPath: string;
enableBuiltinCTA: boolean;
ctaUrl: string;
+ templatePath?: string;
}
export interface WeChatSubpackage {
@@ -49,6 +50,7 @@ export interface WeChatSettings {
subpackages?: WeChatSubpackage[];
workers?: string;
openDataContext?: string;
+ templatePath?: string;
}
// =============================================================================