静下心来我还是可以的-unitywebgl 滑动条增加

<!DOCTYPE html>

<html lang="en-us">

<head>

<meta charset="utf-8" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Unity WebGL Player | QuFuBaoDianWebGL</title>

<link rel="stylesheet" href="TemplateData/style.css" /> <!--增加样式-->

</head>

<body>

<canvas id="unity-canvas"></canvas>

<div id="unity-loading-bar">

<div id="unity-progress-bar-empty">

<div id="unity-progress-bar-full"></div>

</div>

</div>

<script src="Build/DaTongBuild20240424.loader.js"></script>

<script src="./Extend.js"></script>

<script>

var canvas = document.querySelector("#unity-canvas");

const config =

{

dataUrl: "Build/DaTongBuild20240424.data.unityweb",

frameworkUrl: "Build/DaTongBuild20240424.framework.js.unityweb",

codeUrl: "Build/DaTongBuild20240424.wasm.unityweb",

streamingAssetsUrl: "StreamingAssets",

companyName: "DefaultCompany",

productName: "QuFuBaoDianWebGL",

productVersion: "0.1",

};

/*增加显示*/

document.querySelector("#unity-loading-bar").style.display = "block";

createUnityInstance(canvas, config, (progress) =>

{

document.querySelector("#unity-progress-bar-full").style.width =

100 * progress + "%";

}).then((unityInstance) => {

document.querySelector("#unity-loading-bar").style.display = "none";

}).catch((message) => {

alert(message);

});

</script>

</body>

</html>


body,html {

padding: 0;

margin: 0;

width: 100%;

height: 100%;

overflow: hidden;

}

#unity-canvas {

width: 100%;

height: 100%;

background: #231f20

}

#unity-loading-bar {

position: absolute;

left: 50%;

top: 50%;

transform: translate(-50%, -50%);

display: none;

z-index: 1000;

}

#unity-logo {

width: 154px;

height: 130px;

background: url('unity-logo-dark.png') no-repeat center

}

#unity-progress-bar-empty {

width: 141px;

height: 18px;

margin-top: 10px;

margin-left: 6.5px;

background: url('progress-bar-empty-dark.png') no-repeat center

}

#unity-progress-bar-full {

width: 0%;

height: 18px;

margin-top: 10px;

background: url('progress-bar-full-dark.png') no-repeat center

}

#unity-footer {

position: relative

}

相关推荐
电子科技圈8 小时前
XMOS与飞腾云联袂以模块化方案大幅加速音频产品落地
经验分享·嵌入式硬件·mcu·自然语言处理·音视频·腾讯会议·游戏机
01100001乄夵11 小时前
第二课:时序逻辑入门-零基础FPGA闯关教程
经验分享·笔记·学习方法
Teacher.chenchong11 小时前
生态环境影响评价图件制作:融合ArcGIS与ENVI,掌握土地利用、植被覆盖、土壤侵蚀、水系提取等专题制图技术!
经验分享
骑猪兜风23321 小时前
2025 年的热门 AI 编程工具评测:Cursor、Claude Code、Codex、Lovable、v0 等
经验分享
许长安1 天前
c/c++ static关键字详解
c语言·c++·经验分享·笔记
蒙奇D索大1 天前
【算法】递归的艺术:从本质思想到递归树,深入剖析算法的性能权衡
经验分享·笔记·算法·改行学it
洛白白1 天前
“职场心态与心穷
经验分享·学习·生活·学习方法
有过~1 天前
多功能电脑PDF转换工具Icecream PDFv3.15 中文绿色便携版
经验分享·科技·pdf·办公软件
海边夕阳20061 天前
MVCC核心原理解密:从隐藏字段到版本链的完整解析
经验分享·学习·数据库架构·mvcc