Customizing the Unity Web Player loading screen

官方文档在这里

用的是params加new UnityObject2({ params: params })的方法。BOM2项目中我一度怎么调试customize prograss bar都不出。后来找到原因是我用的另外一个结构(config包含params的方法),本该是params的参数写到了config里了。

网页中<script>里正确设置参数的方法:

var config = {

    width : 960,
    height : 370,
    params : {
        disableContextMenu : true,
        disableFullscreen : true,
        backgroundcolor : "EEEEEE",
        bordercolor: "EEEEEE",
        textcolor : "FFFFFF",
        logoimage : "Halliburton.png",
        progressbarimage : "MyProgressBar.png",
        progressframeimage : "MyProgressFrame.png"
    }
};
var u = new UnityObject2(config);
u.observeProgress(function(progress) {
    var $missingScreen = jQuery(progress.targetEl).find(".missing");
    switch(progress.pluginStatus) {
        case "unsupported":
            showUnsupported();
            break;
        case "broken":
            alert("You will need to restart your browser after installation.");
            break;
        case "missing":
            $missingScreen.find("a").click(function(e) {
                e.stopPropagation();
                e.preventDefault();
                u.installPlugin();
                return false;
            });
            $missingScreen.show();
            break;
        case "installed":
            $missingScreen.remove();
            break;
        case "first":
            break;
    }
});
jQuery(function() {
    u.initPlugin(jQuery("#unityPlayer")[0], "WebPlayerBuild.unity3d");
});
原文地址:https://www.cnblogs.com/shawnzxx/p/2858353.html