Browser Game Engine Detector (+ Version)

Detects current game engine

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Browser Game Engine Detector (+ Version)
// @description Detects current game engine
// @match        *://*/*
// @grant        none
// @license MIT
// @version 0.0.1.20260321154450
// @namespace https://greasyfork.org/users/1492052
// ==/UserScript==

(function() {

    function detectEngine() {
        let engine = "Unknown";
        let version = "Unknown";

        // Phaser
        if (window.Phaser) {
            engine = "Phaser";
            version = window.Phaser.VERSION || version;
        }

        else if (window.cc) {
            engine = "Cocos Creator";
            version = window.cc.ENGINE_VERSION || version;
        }

        else if (window.createUnityInstance) {
            engine = "Unity WebGL";
            if (window.Module && window.Module.unityVersion) {
                version = window.Module.unityVersion;
            } else {
                version = "Check UnityLoader.js filename";
            }
        }

        else if (window.THREE) {
            engine = "Three.js";
            version = window.THREE.REVISION || version;
        }

        else if (window.ex) {
            engine = "Excaliber.js";
            version = "Unknown";
        }

        else if (window.pc) {
            engine = "PlayCanvas";
            version = window.pc.version || version;
        }

        else if (window.BABYLON) {
            engine = "Babylon.js";
            version = window.BABYLON.Engine ? window.BABYLON.Engine.Version : version;
        }

        else if (window.Engine) {
            engine = "Godot Web";
            version = window.Engine.VERSION || version;
        }

        else if (window.gdjs) {
            engine = "GDevelop";
            version = window.gdjs.VERSION || version;
        }

        else if (window.C3 || window.runtime) {
            engine = "Construct 3";
            if (window.C3 && window.C3.version) version = window.C3.version;
        }
        else {
            const scripts = Array.from(document.scripts).map(s => s.src);
            for (let src of scripts) {
                if (/c3runtime.*\.js/i.test(src)) {
                    engine = "Construct 3";
                    const match = src.match(/c3runtime[-.]([0-9]+)\.js/i);
                    if (match) version = match[1];
                    break;
                }
                if (/c2runtime.*\.js/i.test(src)) {
                    engine = "Construct 2";
                    const match = src.match(/c2runtime[-.]([0-9]+)\.js/i);
                    if (match) version = match[1];
                    break;
                }
                if (/UnityLoader.*\.js/i.test(src)) {
                    engine = "Unity WebGL";
                    const match = src.match(/UnityLoader[-.]([0-9.]+)\.js/i);
                    if (match) version = match[1];
                    break;
                }
            }
        }

        return { engine, version };
    }

    setTimeout(() => {
        const detected = detectEngine();

        if (detected.engine !== "Unknown") {
            const badge = document.createElement("div");
            badge.innerText = `Engine: ${detected.engine} | Version: ${detected.version}`;
            badge.style.position = "fixed";
            badge.style.bottom = "10px";
            badge.style.right = "10px";
            badge.style.background = "black";
            badge.style.color = "white";
            badge.style.padding = "6px 10px";
            badge.style.fontSize = "12px";
            badge.style.zIndex = 999999;
            badge.style.borderRadius = "5px";
            badge.style.fontFamily = "monospace";
            document.body.appendChild(badge);
        }
    }, 2000);

})();