<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <title>Unity WebGL Player | Webasembly</title> <style> *{border:0;margin:0;padding:0} </style> </head> <body> <span>fffffffffff</span> <div id="unity-container" class="unity-desktop"> <canvas id="unity-canvas" width=960 height=600 style="width:960px;height:600px;"></canvas> <div id="unity-loading-bar"> <div id="unity-logo"></div> <div id="unity-progress-bar-empty"> <div id="unity-progress-bar-full"></div> </div> </div> <div id="unity-mobile-warning" style="display:none;"> WebGL builds are not supported on mobile devices. </div> <div id="unity-footer" style="display:none;"> <div id="unity-webgl-logo"></div> <div id="unity-fullscreen-button"></div> <div id="unity-build-title">2021</div> </div> </div> <script> var buildUrl = "Build"; var loaderUrl = buildUrl + "/webgl.loader.js"; var config = { dataUrl: buildUrl + "/webgl.data", frameworkUrl: buildUrl + "/webgl.framework.js", codeUrl: buildUrl + "/webgl.wasm", symbolsUrl: buildUrl + "/", companyName: "DefaultCompany", productName: "Webasembly", productVersion: "0.1", }; </script> <script> document.addEventListener('DOMContentLoaded',function(){ var container = document.querySelector("#unity-container"); var canvas = document.querySelector("#unity-canvas"); var loadingBar = document.querySelector("#unity-loading-bar"); var progressBarFull = document.querySelector("#unity-progress-bar-full"); var fullscreenButton = document.querySelector("#unity-fullscreen-button"); var mobileWarning = document.querySelector("#unity-mobile-warning"); window.canvas = canvas; // By default Unity keeps WebGL canvas render target size matched with // the DOM size of the canvas element (scaled by window.devicePixelRatio) // Set this to false if you want to decouple this synchronization from // happening inside the engine, and you would instead like to size up // the canvas DOM size and WebGL render target sizes yourself. // config.matchWebGLToCanvasSize = false; loadingBar.style.display = "block"; var script = document.createElement("script"); script.src = loaderUrl; script.onload = () => { createUnityInstance(canvas, config, (progress) => { progressBarFull.style.width = 100 * progress + "%"; }).then((unityInstance) => { loadingBar.style.display = "none"; fullscreenButton.onclick = () => { unityInstance.SetFullscreen(1); }; gameInstance = unityInstance; }).catch((message) => { alert(message); }); }; document.body.appendChild(script); canvas.style.width = window.innerWidth+"px"; canvas.style.height = window.innerHeight+"px"; }); </script> <script> var storage = {}; function getStorageValue(key, defaultValue){ var v = storage[key]; if(v === null){ return defaultValue; } if(typeof v!== 'undefined'){ return v; } return defaultValue; } var GBWASMSDK = { GBInitializeSDK(){ gameInstance.SendMessage("GBSDKManagerHandler",'Inited', 200); }, VibrateShort: function (s, f, c) {}, VibrateLong: function (s, f, c) {}, GBStorageSetIntSync: function (key, value) { storage[key] = value; }, GBStorageGetIntSync: function (key, defaultValue) { return getStorageValue(key, defaultValue); }, GBStorageSetFloatSync: function (key, value) { storage[key] = value; }, GBStorageGetFloatSync: function (key, defaultValue) { return getStorageValue(key, defaultValue); }, GBStorageSetStringSync: function (key, value) { storage[key] = value; }, GBStorageGetStringSync: function (key, defaultValue) { return getStorageValue(key, defaultValue || ''); }, GBStorageDeleteAllSync: function () { storage = {}; }, GBStorageDeleteKeySync: function (key) { delete storage[key]; }, GBStorageHasKeySync: function (key) { return typeof storage[key] === 'undefined'; }, GBLogin: function (s, f, c) {}, GBCheckSession: function (s, f, c) {}, GBAu
理解问题<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <title>Unity WebGL Player | Webasembly</title> <style> *{border:0;margin:0;padding:0} </style> </head> <body> <span>fffffffffff</span> <div id="unity-container" class="unity-desktop"> <canvas id="unity-canvas" width=960 height=600 style="width:960px;height:600px;"></canvas> <div id="unity-loading-bar"> <div id="unity-logo"></div> <div id="unity-progress-bar-empty"> <div id="unity-progress-bar-full"></div> </div> </div> <div id="unity-mobile-warning" style="display:none;"> WebGL builds are not supported on mobile devices. </div> <div id="unity-footer" style="display:none;"> <div id="unity-webgl-logo"></div> <div id="unity-fullscreen-button"></div> <div id="unity-build-title">2021</div> </div> </div> <script> var buildUrl = "Build"; var loaderUrl = buildUrl + "/webgl.loader.js"; var config = { dataUrl: buildUrl + "/webgl.data", frameworkUrl: buildUrl + "/webgl.framework.js", codeUrl: buildUrl + "/webgl.wasm", symbolsUrl: buildUrl + "/", companyName: "DefaultCompany", productName: "Webasembly", productVersion: "0.1", }; </script> <script> document.addEventListener('DOMContentLoaded',function(){ var container = document.querySelector("#unity-container"); var canvas = document.querySelector("#unity-canvas"); var loadingBar = document.querySelector("#unity-loading-bar"); var progressBarFull = document.querySelector("#unity-progress-bar-full"); var fullscreenButton = document.querySelector("#unity-fullscreen-button"); var mobileWarning = document.querySelector("#unity-mobile-warning"); window.canvas = canvas; // By default Unity keeps WebGL canvas render target size matched with // the DOM size of the canvas element (scaled by window.devicePixelRatio) // Set this to false if you want to decouple this synchronization from // happening inside the engine, and you would instead like to size up // the canvas DOM size and WebGL render target sizes yourself. // config.matchWebGLToCanvasSize = false; loadingBar.style.display = "block"; var script = document.createElement("script"); script.src = loaderUrl; script.onload = () => { createUnityInstance(canvas, config, (progress) => { progressBarFull.style.width = 100 * progress + "%"; }).then((unityInstance) => { loadingBar.style.display = "none"; fullscreenButton.onclick = () => { unityInstance.SetFullscreen(1); }; gameInstance = unityInstance; }).catch((message) => { alert(message); }); }; document.body.appendChild(script); canvas.style.width = window.innerWidth+"px"; canvas.style.height = window.innerHeight+"px"; }); </script> <script> var storage = {}; function getStorageValue(key, defaultValue){ var v = storage[key]; if(v === null){ return defaultValue; } if(typeof v!== 'undefined'){ return v; } return defaultValue; } var GBWASMSDK = { GBInitializeSDK(){ gameInstance.SendMessage("GBSDKManagerHandler",'Inited', 200); }, VibrateShort: function (s, f, c) {}, VibrateLong: function (s, f, c) {}, GBStorageSetIntSync: function (key, value) { storage[key] = value; }, GBStorageGetIntSync: function (key, defaultValue) { return getStorageValue(key, defaultValue); }, GBStorageSetFloatSync: function (key, value) { storage[key] = value; }, GBStorageGetFloatSync: function (key, defaultValue) { return getStorageValue(key, defaultValue); }, GBStorageSetStringSync: function (key, value) { storage[key] = value; }, GBStorageGetStringSync: function (key, defaultValue) { return getStorageValue(key, defaultValue || ''); }, GBStorageDeleteAllSync: function () { storage = {}; }, GBStorageDeleteKeySync: function (key) { delete storage[key]; }, GBStorageHasKeySync: function (key) { return typeof storage[key] === 'undefined'; }, GBLogin: function (s, f, c) {}, GBCheckSession: function (s, f, c) {}, GBAu
已完成理解「<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <title>Unity WebGL Player | Webasembly</title> <style> *{border:0;margin:0;padding:0} </style> </head> <body> <span>fffffffffff</span> <div id="unity-container" class="unity-desktop"> <canvas id="unity-canvas" width=960 height=600 style="width:960px;height:600px;"></canvas> <div id="unity-loading-bar"> <div id="unity-logo"></div> <div id="unity-progress-bar-empty"> <div id="unity-progress-bar-full"></div> </div> </div> <div id="unity-mobile-warning" style="display:none;"> WebGL builds are not supported on mobile devices. </div> <div id="unity-footer" style="display:none;"> <div id="unity-webgl-logo"></div> <div id="unity-fullscreen-button"></div> <div id="unity-build-title">2021</div> </div> </div> <script> var buildUrl = "Build"; var loaderUrl = buildUrl + "/webgl.loader.js"; var config = { dataUrl: buildUrl + "/webgl.data", frameworkUrl: buildUrl + "/webgl.framework.js", codeUrl: buildUrl + "/webgl.wasm", symbolsUrl: buildUrl + "/", companyName: "DefaultCompany", productName: "Webasembly", productVersion: "0.1", }; </script> <script> document.addEventListener('DOMContentLoaded',function(){ var container = document.querySelector("#unity-container"); var canvas = document.querySelector("#unity-canvas"); var loadingBar = document.querySelector("#unity-loading-bar"); var progressBarFull = document.querySelector("#unity-progress-bar-full"); var fullscreenButton = document.querySelector("#unity-fullscreen-button"); var mobileWarning = document.querySelector("#unity-mobile-warning"); window.canvas = canvas; // By default Unity keeps WebGL canvas render target size matched with // the DOM size of the canvas element (scaled by window.devicePixelRatio) // Set this to false if you want to decouple this synchronization from // happening inside the engine, and you would instead like to size up // the canvas DOM size and WebGL render target sizes yourself. // config.matchWebGLToCanvasSize = false; loadingBar.style.display = "block"; var script = document.createElement("script"); script.src = loaderUrl; script.onload = () => { createUnityInstance(canvas, config, (progress) => { progressBarFull.style.width = 100 * progress + "%"; }).then((unityInstance) => { loadingBar.style.display = "none"; fullscreenButton.onclick = () => { unityInstance.SetFullscreen(1); }; gameInstance = unityInstance; }).catch((message) => { alert(message); }); }; document.body.appendChild(script); canvas.style.width = window.innerWidth+"px"; canvas.style.height = window.innerHeight+"px"; }); </script> <script> var storage = {}; function getStorageValue(key, defaultValue){ var v = storage[key]; if(v === null){ return defaultValue; } if(typeof v!== 'undefined'){ return v; } return defaultValue; } var GBWASMSDK = { GBInitializeSDK(){ gameInstance.SendMessage("GBSDKManagerHandler",'Inited', 200); }, VibrateShort: function (s, f, c) {}, VibrateLong: function (s, f, c) {}, GBStorageSetIntSync: function (key, value) { storage[key] = value; }, GBStorageGetIntSync: function (key, defaultValue) { return getStorageValue(key, defaultValue); }, GBStorageSetFloatSync: function (key, value) { storage[key] = value; }, GBStorageGetFloatSync: function (key, defaultValue) { return getStorageValue(key, defaultValue); }, GBStorageSetStringSync: function (key, value) { storage[key] = value; }, GBStorageGetStringSync: function (key, defaultValue) { return getStorageValue(key, defaultValue || ''); }, GBStorageDeleteAllSync: function () { storage = {}; }, GBStorageDeleteKeySync: function (key) { delete storage[key]; }, GBStorageHasKeySync: function (key) { return typeof storage[key] === 'undefined'; }, GBLogin: function (s, f, c) {}, GBCheckSession: function (s, f, c) {}, GBAu」
展开阅读网页
WebGL Player 设置
WebGL Player 设置允许开发者自定义 Unity WebGL 项目的各种属性,以优化性能和用户体验。以下是主要设置的详细说明。
分辨率和展示
此部分允许开发者设置 WebGL 画布的默认宽度和高度,并决定内容是否在后台运行。
- Default Canvas Width: 设置 WebGL 画布的默认宽度。
- Default Canvas Height: 设置 WebGL 画布的默认高度。
- Run In Background: 启用后,内容将在画布或浏览器窗口失去焦点时继续运行。
WebGL 模板
开发者可以选择默认或最小化的模板,或指定自定义模板来运行 WebGL 内容。
- Default: 简单的白色页面,灰色画布上有一个加载进度条。
- Minimal: 仅包含运行 WebGL 内容所需的样板代码。
其他设置
此部分包含多个子部分,用于自定义渲染、配置、优化、日志记录和旧版选项。
渲染
- Color Space: 选择用于渲染的颜色空间,选项为 Gamma 或 Linear。
配置
- Auto Graphics API: 启用后,Unity 会自动选择和排序图形 API。禁用后,开发者可以手动选择和排序。
优化
- Keep Loaded Shaders Alive: 启用后,防止卸载着色器。
- Prebake Collision Meshes: 启用后,在构建时将碰撞数据添加到网格。
日志记录
- Logging: 启用后,允许在控制台中记录调试信息。
旧版
- Legacy: 包含一些旧版选项,用于兼容旧版 WebGL 内容。
发布设置
此部分允许开发者设置发布选项,如数据缓存、AssetBundle 剥离和代码剥离。
- Data Caching: 启用后,浏览器会将主数据文件缓存到 IndexedDB 数据库中。
- AssetBundle Stripping: 启用后,Unity 会从构建中删除未使用的 AssetBundle。
- Code Stripping: 启用后,Unity 会从构建中删除未使用的代码。
通过这些设置,开发者可以优化 Unity WebGL 项目的性能和用户体验,确保内容在各种浏览器和设备上都能流畅运行。