├── CubeSphere
├── Build
│ ├── build.data
│ ├── build.framework.js
│ ├── build.loader.js
│ └── build.wasm
├── TemplateData
│ ├── favicon.ico
│ ├── fullscreen-button.png
│ ├── progress-bar-empty-dark.png
│ ├── progress-bar-empty-light.png
│ ├── progress-bar-full-dark.png
│ ├── progress-bar-full-light.png
│ ├── style.css
│ ├── unity-logo-dark.png
│ ├── unity-logo-light.png
│ └── webgl-logo.png
├── index.html
└── readme.md
├── DataURLTest
├── DataURLTest.cs
├── Release
│ ├── UnityLoader.js
│ ├── build.datagz
│ ├── build.jsgz
│ └── build.memgz
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullbar.png
│ ├── fullscreen.png
│ ├── loadingbar.png
│ ├── logo.png
│ ├── progresslogo.png
│ └── style.css
└── index.html
├── ExpressionParserWebGL
├── Build
│ ├── ExpressionParserWebGL.data.unityweb
│ ├── ExpressionParserWebGL.json
│ ├── ExpressionParserWebGL.wasm.code.unityweb
│ ├── ExpressionParserWebGL.wasm.framework.unityweb
│ └── UnityLoader.js
├── ExpressionParser.cs
├── ExpressionParserTest.cs
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullscreen.png
│ ├── progressEmpty.Dark.png
│ ├── progressEmpty.Light.png
│ ├── progressFull.Dark.png
│ ├── progressFull.Light.png
│ ├── progressLogo.Dark.png
│ ├── progressLogo.Light.png
│ ├── style.css
│ └── webgl-logo.png
└── index.html
├── GraphCalc
├── Build
│ ├── GraphCalc.data
│ ├── GraphCalc.framework.js
│ ├── GraphCalc.loader.js
│ └── GraphCalc.wasm
├── TemplateData
│ ├── MemoryProfiler.png
│ ├── favicon.ico
│ ├── fullscreen-button.png
│ ├── progress-bar-empty-dark.png
│ ├── progress-bar-empty-light.png
│ ├── progress-bar-full-dark.png
│ ├── progress-bar-full-light.png
│ ├── style.css
│ ├── unity-logo-dark.png
│ ├── unity-logo-light.png
│ ├── webgl-logo.png
│ └── webmemd-icon.png
└── index.html
├── Hanoi
├── Build
│ ├── UnityLoader.js
│ ├── build.data.unityweb
│ ├── build.json
│ ├── build.wasm.code.unityweb
│ └── build.wasm.framework.unityweb
├── Hanoi.cs
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullscreen.png
│ ├── progressEmpty.Dark.png
│ ├── progressEmpty.Light.png
│ ├── progressFull.Dark.png
│ ├── progressFull.Light.png
│ ├── progressLogo.Dark.png
│ ├── progressLogo.Light.png
│ ├── style.css
│ └── webgl-logo.png
└── index.html
├── HealthBarExample
├── Build
│ ├── HealthBarExample.data.unityweb
│ ├── HealthBarExample.framework.js.unityweb
│ ├── HealthBarExample.loader.js
│ └── HealthBarExample.wasm.unityweb
├── HealthBarExample.unitypackage
├── TemplateData
│ ├── favicon.ico
│ ├── fullscreen-button.png
│ ├── progress-bar-empty-dark.png
│ ├── progress-bar-empty-light.png
│ ├── progress-bar-full-dark.png
│ ├── progress-bar-full-light.png
│ ├── style.css
│ ├── unity-logo-dark.png
│ ├── unity-logo-light.png
│ └── webgl-logo.png
└── index.html
├── HowUnityWorks
├── Build
│ ├── UnityLoader.js
│ ├── WebGL.asm.code.unityweb
│ ├── WebGL.asm.framework.unityweb
│ ├── WebGL.asm.memory.unityweb
│ ├── WebGL.data.unityweb
│ └── WebGL.json
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullscreen.png
│ ├── progressEmpty.Dark.png
│ ├── progressEmpty.Light.png
│ ├── progressFull.Dark.png
│ ├── progressFull.Light.png
│ ├── progressLogo.Dark.png
│ ├── progressLogo.Light.png
│ ├── style.css
│ └── webgl-logo.png
└── index.html
├── ImageShapeDetection
├── Release
│ ├── UnityLoader.js
│ ├── build.datagz
│ ├── build.jsgz
│ └── build.memgz
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullbar.png
│ ├── fullscreen.png
│ ├── loadingbar.png
│ ├── logo.png
│ ├── progresslogo.png
│ └── style.css
└── index.html
├── InfiniteZoomExample
├── Build
│ ├── UnityLoader.js
│ ├── WebGL.data.unityweb
│ ├── WebGL.json
│ ├── WebGL.wasm.code.unityweb
│ └── WebGL.wasm.framework.unityweb
├── InfiniteZoomPack.unitypackage
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullscreen.png
│ ├── progressEmpty.Dark.png
│ ├── progressEmpty.Light.png
│ ├── progressFull.Dark.png
│ ├── progressFull.Light.png
│ ├── progressLogo.Dark.png
│ ├── progressLogo.Light.png
│ ├── style.css
│ └── webgl-logo.png
└── index.html
├── InterceptExample
├── Build
│ ├── UnityLoader.js
│ ├── build.data.unityweb
│ ├── build.json
│ ├── build.wasm.code.unityweb
│ └── build.wasm.framework.unityweb
├── Intercept.unitypackage
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullscreen.png
│ ├── progressEmpty.Dark.png
│ ├── progressEmpty.Light.png
│ ├── progressFull.Dark.png
│ ├── progressFull.Light.png
│ ├── progressLogo.Dark.png
│ ├── progressLogo.Light.png
│ ├── style.css
│ └── webgl-logo.png
└── index.html
├── Mandelbrot
├── MandelbrotVisualizer.cs
├── Release
│ ├── URL.txt
│ ├── UnityLoader.js
│ ├── WebGL.datagz
│ ├── WebGL.jsgz
│ └── WebGL.memgz
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullbar.png
│ ├── fullscreen.png
│ ├── loadingbar.png
│ ├── logo.png
│ ├── progresslogo.png
│ └── style.css
├── URLParameters.cs
└── index.html
├── MaskShader
├── Build
│ ├── UnityLoader.js
│ ├── WebGL.data.unityweb
│ ├── WebGL.json
│ ├── WebGL.wasm.code.unityweb
│ └── WebGL.wasm.framework.unityweb
├── MaskShaderExample.unitypackage
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullscreen.png
│ ├── progressEmpty.Dark.png
│ ├── progressEmpty.Light.png
│ ├── progressFull.Dark.png
│ ├── progressFull.Light.png
│ ├── progressLogo.Dark.png
│ ├── progressLogo.Light.png
│ ├── style.css
│ └── webgl-logo.png
└── index.html
├── Particles
├── Build
│ ├── Particles.asm.code.unityweb
│ ├── Particles.asm.framework.unityweb
│ ├── Particles.asm.memory.unityweb
│ ├── Particles.data.unityweb
│ ├── Particles.json
│ └── UnityLoader.js
├── Particles.cs
├── ParticlesDemo.unitypackage
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullscreen.png
│ ├── progressEmpty.Dark.png
│ ├── progressEmpty.Light.png
│ ├── progressFull.Dark.png
│ ├── progressFull.Light.png
│ ├── progressLogo.Dark.png
│ ├── progressLogo.Light.png
│ ├── style.css
│ └── webgl-logo.png
└── index.html
├── README.md
├── SolarSystemDiagram
├── Build
│ ├── SolarSystemDiagram.data
│ ├── SolarSystemDiagram.framework.js
│ ├── SolarSystemDiagram.loader.js
│ └── SolarSystemDiagram.wasm
├── TemplateData
│ ├── favicon.ico
│ ├── fullscreen-button.png
│ ├── progress-bar-empty-dark.png
│ ├── progress-bar-empty-light.png
│ ├── progress-bar-full-dark.png
│ ├── progress-bar-full-light.png
│ ├── style.css
│ ├── unity-logo-dark.png
│ ├── unity-logo-light.png
│ └── webgl-logo.png
└── index.html
├── SpaceTest
├── Build
│ ├── SpaceTest.data
│ ├── SpaceTest.framework.js
│ ├── SpaceTest.loader.js
│ └── SpaceTest.wasm
├── StreamingAssets
│ └── UnityServicesProjectConfiguration.json
├── TemplateData
│ ├── favicon.ico
│ ├── fullscreen-button.png
│ ├── progress-bar-empty-dark.png
│ ├── progress-bar-empty-light.png
│ ├── progress-bar-full-dark.png
│ ├── progress-bar-full-light.png
│ ├── style.css
│ ├── unity-logo-dark.png
│ ├── unity-logo-light.png
│ └── webgl-logo.png
└── index.html
├── Teapot
├── Release
│ ├── Teapot.datagz
│ ├── Teapot.jsgz
│ ├── Teapot.memgz
│ └── UnityLoader.js
├── TeapotTest.zip
├── TemplateData
│ ├── UnityProgress.js
│ ├── favicon.ico
│ ├── fullbar.png
│ ├── fullscreen.png
│ ├── loadingbar.png
│ ├── logo.png
│ ├── progresslogo.png
│ └── style.css
└── index.html
├── Test
└── ImageTest.html
├── TextureDrawing
├── Build
│ ├── WebGLBuild.data
│ ├── WebGLBuild.framework.js
│ ├── WebGLBuild.loader.js
│ └── WebGLBuild.wasm
├── TemplateData
│ ├── MemoryProfiler.png
│ ├── favicon.ico
│ ├── fullscreen-button.png
│ ├── progress-bar-empty-dark.png
│ ├── progress-bar-empty-light.png
│ ├── progress-bar-full-dark.png
│ ├── progress-bar-full-light.png
│ ├── style.css
│ ├── unity-logo-dark.png
│ ├── unity-logo-light.png
│ ├── webgl-logo.png
│ └── webmemd-icon.png
└── index.html
├── UVMapping
├── Build
│ ├── UVMapping.data.unityweb
│ ├── UVMapping.framework.js.unityweb
│ ├── UVMapping.loader.js
│ └── UVMapping.wasm.unityweb
├── TemplateData
│ ├── MemoryProfiler.png
│ ├── favicon.ico
│ ├── fullscreen-button.png
│ ├── progress-bar-empty-dark.png
│ ├── progress-bar-empty-light.png
│ ├── progress-bar-full-dark.png
│ ├── progress-bar-full-light.png
│ ├── style.css
│ ├── unity-logo-dark.png
│ ├── unity-logo-light.png
│ ├── webgl-logo.png
│ └── webmemd-icon.png
└── index.html
├── UnityAnswers
└── VoronoiImages
│ ├── readme.md
│ ├── w2048_h1024_s10000_t11327ms.png
│ ├── w2048_h1024_s50_t5643ms.png
│ ├── w4096_h4096_s100000_t88932ms.png
│ └── w4096_h4096_s10000_t75601ms.png
└── VisPortals
├── Release
├── UnityLoader.js
├── VisPortalExample.datagz
├── VisPortalExample.jsgz
└── VisPortalExample.memgz
├── TemplateData
├── UnityProgress.js
├── favicon.ico
├── fullbar.png
├── fullscreen.png
├── loadingbar.png
├── logo.png
├── progresslogo.png
└── style.css
├── VisPortals.zip
└── index.html
/CubeSphere/Build/build.data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/Build/build.data
--------------------------------------------------------------------------------
/CubeSphere/Build/build.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/Build/build.wasm
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/fullscreen-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/fullscreen-button.png
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/progress-bar-empty-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/progress-bar-empty-dark.png
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/progress-bar-empty-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/progress-bar-empty-light.png
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/progress-bar-full-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/progress-bar-full-dark.png
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/progress-bar-full-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/progress-bar-full-light.png
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0 }
2 | #unity-container { position: absolute }
3 | #unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4 | #unity-container.unity-mobile { width: 100%; height: 100% }
5 | #unity-canvas { background: #1F1F20 }
6 | .unity-mobile #unity-canvas { width: 100%; height: 100% }
7 | #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8 | #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9 | #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 }
10 | #unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11 | #unity-footer { position: relative }
12 | .unity-mobile #unity-footer { display: none }
13 | #unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14 | #unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15 | #unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16 | #unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
17 |
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/unity-logo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/unity-logo-dark.png
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/unity-logo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/unity-logo-light.png
--------------------------------------------------------------------------------
/CubeSphere/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/CubeSphere/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/CubeSphere/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | SphereTerrainNew
7 |
8 |
9 |
10 |
11 |
26 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/CubeSphere/readme.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/DataURLTest/DataURLTest.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class DataURLTest : MonoBehaviour
5 | {
6 | string text = "Some example text\nFeel free to edit and press 'Download text file'\n";
7 |
8 | void OnGUI()
9 | {
10 | GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20));
11 |
12 | GUILayout.BeginHorizontal();
13 | if (GUILayout.Button("Download random data"))
14 | {
15 | byte[] randomData = new byte[Random.Range(200, 500)];
16 | for (int i = 0; i < randomData.Length; i++)
17 | randomData[i] = (byte)Random.Range(0, 256);
18 | WebDownloadHelper.InitiateDownload("ExampleFile.dat",randomData);
19 | }
20 | if (GUILayout.Button("Download text file"))
21 | {
22 | WebDownloadHelper.InitiateDownload("Textfile.txt", text);
23 | }
24 | GUILayout.EndHorizontal();
25 |
26 | text = GUILayout.TextArea(text, GUILayout.ExpandHeight(true));
27 | GUILayout.EndArea();
28 | }
29 | }
30 |
31 | public class WebDownloadHelper
32 | {
33 | // Source: http://stackoverflow.com/a/27284736/1607924
34 | static string scriptTemplate = @"
35 | var link = document.createElement(""a"");
36 | link.download = '{0}';
37 | link.href = 'data:application/octet-stream;charset=utf-8;base64,{1}';
38 | document.body.appendChild(link);
39 | link.click();
40 | document.body.removeChild(link);
41 | delete link;
42 | ";
43 |
44 | public static void InitiateDownload(string aName, byte[] aData)
45 | {
46 | string base64 = System.Convert.ToBase64String(aData);
47 | string script = string.Format(scriptTemplate, aName, base64);
48 | Application.ExternalEval(script);
49 | }
50 | public static void InitiateDownload(string aName, string aData)
51 | {
52 | byte[] data = System.Text.Encoding.UTF8.GetBytes(aData);
53 | InitiateDownload(aName, data);
54 | }
55 | }
--------------------------------------------------------------------------------
/DataURLTest/Release/build.datagz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/Release/build.datagz
--------------------------------------------------------------------------------
/DataURLTest/Release/build.jsgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/Release/build.jsgz
--------------------------------------------------------------------------------
/DataURLTest/Release/build.memgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/Release/build.memgz
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress (dom) {
2 | this.progress = 0.0;
3 | this.message = "";
4 | this.dom = dom;
5 |
6 | var parent = dom.parentNode;
7 |
8 | var background = document.createElement("div");
9 | background.style.background = "#4D4D4D";
10 | background.style.position = "absolute";
11 | parent.appendChild(background);
12 | this.background = background;
13 |
14 | var logoImage = document.createElement("img");
15 | logoImage.src = "TemplateData/progresslogo.png";
16 | logoImage.style.position = "absolute";
17 | parent.appendChild(logoImage);
18 | this.logoImage = logoImage;
19 |
20 | var progressFrame = document.createElement("img");
21 | progressFrame.src = "TemplateData/loadingbar.png";
22 | progressFrame.style.position = "absolute";
23 | parent.appendChild(progressFrame);
24 | this.progressFrame = progressFrame;
25 |
26 | var progressBar = document.createElement("img");
27 | progressBar.src = "TemplateData/fullbar.png";
28 | progressBar.style.position = "absolute";
29 | parent.appendChild(progressBar);
30 | this.progressBar = progressBar;
31 |
32 | var messageArea = document.createElement("p");
33 | messageArea.style.position = "absolute";
34 | parent.appendChild(messageArea);
35 | this.messageArea = messageArea;
36 |
37 |
38 | this.SetProgress = function (progress) {
39 | if (this.progress < progress)
40 | this.progress = progress;
41 | this.messageArea.style.display = "none";
42 | this.progressFrame.style.display = "inline";
43 | this.progressBar.style.display = "inline";
44 | this.Update();
45 | }
46 |
47 | this.SetMessage = function (message) {
48 | this.message = message;
49 | this.background.style.display = "inline";
50 | this.logoImage.style.display = "inline";
51 | this.progressFrame.style.display = "none";
52 | this.progressBar.style.display = "none";
53 | this.Update();
54 | }
55 |
56 | this.Clear = function() {
57 | this.background.style.display = "none";
58 | this.logoImage.style.display = "none";
59 | this.progressFrame.style.display = "none";
60 | this.progressBar.style.display = "none";
61 | }
62 |
63 | this.Update = function() {
64 | this.background.style.top = this.dom.offsetTop + 'px';
65 | this.background.style.left = this.dom.offsetLeft + 'px';
66 | this.background.style.width = this.dom.offsetWidth + 'px';
67 | this.background.style.height = this.dom.offsetHeight + 'px';
68 |
69 | var logoImg = new Image();
70 | logoImg.src = this.logoImage.src;
71 | var progressFrameImg = new Image();
72 | progressFrameImg.src = this.progressFrame.src;
73 |
74 | this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px';
75 | this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px';
76 | this.logoImage.style.width = logoImg.width+'px';
77 | this.logoImage.style.height = logoImg.height+'px';
78 |
79 | this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px';
80 | this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px';
81 | this.progressFrame.width = progressFrameImg.width;
82 | this.progressFrame.height = progressFrameImg.height;
83 |
84 | this.progressBar.style.top = this.progressFrame.style.top;
85 | this.progressBar.style.left = this.progressFrame.style.left;
86 | this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1);
87 | this.progressBar.height = progressFrameImg.height;
88 |
89 | this.messageArea.style.top = this.progressFrame.style.top;
90 | this.messageArea.style.left = 0;
91 | this.messageArea.style.width = '100%';
92 | this.messageArea.style.textAlign = 'center';
93 | this.messageArea.innerHTML = this.message;
94 | }
95 |
96 | this.Update ();
97 | }
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/fullbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/TemplateData/fullbar.png
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/loadingbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/TemplateData/loadingbar.png
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/TemplateData/logo.png
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/progresslogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/DataURLTest/TemplateData/progresslogo.png
--------------------------------------------------------------------------------
/DataURLTest/TemplateData/style.css:
--------------------------------------------------------------------------------
1 |
2 | /****************************************
3 | ==== RESETS
4 | ****************************************/
5 |
6 | html,body,div,canvas { margin: 0; padding: 0; }
7 | ::-moz-selection { color: #333; text-shadow: none; }
8 | ::selection { color: #333; text-shadow: none; }
9 | .clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
10 | .clear { display: inline-table; clear: both; }
11 | /* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */
12 |
13 | /****************************************
14 | ==== LAYOUT
15 | ****************************************/
16 |
17 | html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }
18 | body { }
19 | p.header, p.footer { display: none; }
20 | div.logo { width: 204px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; }
21 | div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; }
22 | .template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }
23 | .template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
24 | .fullscreen { float: right; position: relative; z-index: 10; }
25 |
26 | body.template { }
27 | .template .template-wrap { }
28 | .template .template-wrap canvas { }
29 |
--------------------------------------------------------------------------------
/DataURLTest/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | DataURLTest
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Source script:
DataURLTest.cs
16 |
17 |
18 |
19 |
DataURLTest
20 |
21 |
22 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/ExpressionParserWebGL/Build/ExpressionParserWebGL.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/Build/ExpressionParserWebGL.data.unityweb
--------------------------------------------------------------------------------
/ExpressionParserWebGL/Build/ExpressionParserWebGL.json:
--------------------------------------------------------------------------------
1 | {
2 | "companyName": "B83",
3 | "productName": "ExpressionParserTest",
4 | "dataUrl": "ExpressionParserWebGL.data.unityweb",
5 | "wasmCodeUrl": "ExpressionParserWebGL.wasm.code.unityweb",
6 | "wasmFrameworkUrl": "ExpressionParserWebGL.wasm.framework.unityweb",
7 | "TOTAL_MEMORY": 268435456,
8 | "graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],
9 | "webglContextAttributes": {"preserveDrawingBuffer": false},
10 | "splashScreenStyle": "Dark",
11 | "backgroundColor": "#231F20"
12 | }
--------------------------------------------------------------------------------
/ExpressionParserWebGL/Build/ExpressionParserWebGL.wasm.code.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/Build/ExpressionParserWebGL.wasm.code.unityweb
--------------------------------------------------------------------------------
/ExpressionParserWebGL/Build/ExpressionParserWebGL.wasm.framework.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/Build/ExpressionParserWebGL.wasm.framework.unityweb
--------------------------------------------------------------------------------
/ExpressionParserWebGL/ExpressionParserTest.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using B83.ExpressionParser;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 |
7 | public class ExtendedParser : ExpressionParser
8 | {
9 | public ExtendedParser()
10 | {
11 | AddFunc("repeat", Repeat);
12 | AddFunc("pingpong", PingPong);
13 | AddFunc("clamp", (p) => p[0] < 0 ? 0 : p[0] > 1 ? 1 : p[0]);
14 | AddFunc("lerp", (p) => p[0] +(p.ElementAtOrDefault(1)-p[0])*p.ElementAtOrDefault(2));
15 | AddConst("time", () => Time.time);
16 | AddConst("sinTest", ()=>555);
17 | AddFunc("effect", (p) => p[0]);
18 | // pow doesn't work with negative base values and non-integer-power
19 | // this simply calulates the positive pow and keeps the sign
20 | AddFunc("pow", (p) => p[0] < 0 ? -System.Math.Pow(-p[0], p.ElementAtOrDefault(1)) : System.Math.Pow(p[0], p.ElementAtOrDefault(1)));
21 | }
22 | double Repeat(params double[] aParams)
23 | {
24 | if (aParams.Length == 1)
25 | return aParams[0];
26 | double v = aParams[0];
27 | double l = aParams[1];
28 | return v - System.Math.Floor(v / l) * l;
29 | }
30 | double PingPong(params double[] aParams)
31 | {
32 | if (aParams.Length == 1)
33 | return aParams[0];
34 | double v = aParams[0];
35 | double l = aParams[1];
36 | v = Repeat(v, l * 2d);
37 | return l - System.Math.Abs(v - l);
38 | }
39 | }
40 |
41 | public class ExpressionParserTest : MonoBehaviour
42 | {
43 | string expression = "sin(x*PI)*(0.6+sin(x*pingpong(time,100)*PI*8)*0.4), cos(x*PI)*(0.6+sin(x*pingpong(time,100)*PI*4)*0.4)";
44 | string errorText = "";
45 | Rect winPos = new Rect(10,40,700,300);
46 | ExpressionParser m_Parser = new ExtendedParser();
47 | Expression exp = null;
48 | Material m_Mat;
49 | public GUIStyle m_TextFieldStyle;
50 | private void Awake()
51 | {
52 | m_TextFieldStyle = null;
53 | m_Mat = Resources.Load("Plane_No_zTest");
54 | #if UNITY_EDITOR
55 | if (m_Mat == null)
56 | {
57 | var resDir = new System.IO.DirectoryInfo(System.IO.Path.Combine(Application.dataPath, "Resources"));
58 | if (!resDir.Exists)
59 | resDir.Create();
60 | Shader s = Shader.Find("Plane/No zTest");
61 | if (s == null)
62 | {
63 | string shaderText = "Shader \"Plane/No zTest\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha ZWrite Off Cull Off Fog { Mode Off } BindChannels { Bind \"Color\",color } } } }";
64 | string path = System.IO.Path.Combine(resDir.FullName, "Plane_No_zTest.shader");
65 | Debug.Log("Shader missing, create asset: " + path);
66 | System.IO.File.WriteAllText(path, shaderText);
67 | UnityEditor.AssetDatabase.Refresh(UnityEditor.ImportAssetOptions.ForceSynchronousImport);
68 | UnityEditor.AssetDatabase.LoadAssetAtPath("Resources/Plane_No_zTest.shader");
69 | s = Shader.Find("Plane/No zTest");
70 | }
71 | var mat = new Material(s);
72 | mat.name = "Plane_No_zTest";
73 | UnityEditor.AssetDatabase.CreateAsset(mat, "Assets/Resources/Plane_No_zTest.mat");
74 | m_Mat = mat;
75 | }
76 | #endif
77 | Parse();
78 | }
79 | Vector2 Execute(float aValue)
80 | {
81 | if (exp != null)
82 | {
83 | foreach (var P in exp.Parameters)
84 | P.Value.Value = aValue;
85 | var values = exp.MultiValue;
86 | if (values.Length == 1)
87 | return new Vector2(aValue, (float)values[0]);
88 | return new Vector2((float)values[0], (float)values[1]);
89 | }
90 | return new Vector2(aValue,0);
91 | }
92 | void Parse()
93 | {
94 | try
95 | {
96 | exp = m_Parser.EvaluateExpression(expression);
97 | if (exp.ParsingError != null)
98 | {
99 | errorText = "Parsing Error: " + exp.ParsingError;
100 | exp = null;
101 | }
102 | else
103 | errorText = "Parsing successful:\n" + exp.ToString();
104 | }
105 | catch (System.Exception e)
106 | {
107 | errorText = "E Parsing Error: " + e.Message;
108 | }
109 | }
110 | void OnGUI()
111 | {
112 | winPos = GUI.Window(0, winPos,DrawWindow, "");
113 | winPos.width = Mathf.Clamp(winPos.width, 100, Screen.width - 20);
114 | winPos.height = Mathf.Clamp(winPos.height, 100, Screen.height - 20);
115 | winPos.x = Mathf.Clamp(winPos.x, 20 - winPos.width, Screen.width-20);
116 | winPos.y = Mathf.Clamp(winPos.y, 20 - winPos.height, Screen.height - 20);
117 |
118 | if (Event.current.type == EventType.Repaint)
119 | {
120 | DrawCurve();
121 | }
122 | }
123 | void Sample(string aButtonName, string aExpression)
124 | {
125 | if (GUILayout.Button(aButtonName))
126 | {
127 | expression = aExpression;
128 | Parse();
129 | }
130 | }
131 |
132 | private void DrawWindow(int id)
133 | {
134 | GUI.changed = false;
135 | GUILayout.BeginHorizontal();
136 | Sample("parabola", "x,5*x^2 -0.8");
137 | Sample("sinus", "x,sin(x*PI*5)");
138 | Sample("circle", "sin(x*PI), cos(x*PI)");
139 | Sample("sin^3, cos^3", "sin(x*PI)^3*(0.9+rnd(0.2)), cos(x*PI)^3*(0.9+rnd(0.2))");
140 | Sample("start", "sin(x*PI)*(0.6+sin(x*pingpong(time,100)*PI*8)*0.4), cos(x*PI)*(0.6+sin(x*pingpong(time,100)*PI*4)*0.4)");
141 | Sample("wobble", "sin(x*PI)*(0.5-sin(x*PI*10+time)*0.05-sin(x*PI*7-time)*0.05), cos(x*PI)*(0.5-sin(x*PI*10+time)*0.05-sin(x*PI*7-time)*0.05)");
142 | Sample("parabola2", "x*sin(time*PI/2) - (5*x^2 -0.8)*cos(time*PI/2), (5*x^2 -0.8)*sin(time*PI/2) + x*cos(time*PI/2)");
143 | GUILayout.EndHorizontal();
144 | if (m_TextFieldStyle == null)
145 | {
146 | m_TextFieldStyle = new GUIStyle("TextArea");
147 | m_TextFieldStyle.font = Font.CreateDynamicFontFromOSFont("Courier New", 18);
148 | m_TextFieldStyle.fontStyle = FontStyle.Bold;
149 | }
150 | expression = GUILayout.TextArea(expression, m_TextFieldStyle, GUILayout.ExpandHeight(true));
151 | //m_ShowTree = GUILayout.Toggle(m_ShowTree, "Show Tree", "Button");
152 | GUILayout.Label(errorText, "label");
153 |
154 | if (GUI.changed)
155 | Parse();
156 |
157 | GUI.DragWindow();
158 | }
159 |
160 |
161 | private void DrawCurve()
162 | {
163 | GL.PushMatrix();
164 | GL.Viewport(new Rect(10, 10, Screen.width - 20, Screen.height - 20));
165 | GL.LoadPixelMatrix(-1, 1, -1, 1);
166 |
167 | m_Mat.SetPass(0);
168 | GL.Begin(GL.LINES);
169 | float start = -1.0f;
170 | float end = 1.0f;
171 | var lastV = Execute(start);
172 | for(float x = start; x < end; x+= 0.001f)
173 | {
174 | var val = Execute(x);
175 | GL.Color(Color.red);
176 | GL.Vertex3(lastV.x , lastV.y, -1);
177 | GL.Vertex3(val.x , val.y, -1);
178 | lastV = val;
179 | }
180 | GL.Color(Color.green);
181 | GL.Vertex3(0, -1, -1);
182 | GL.Vertex3(0, 1, -1);
183 | GL.Vertex3(-1,0, -1);
184 | GL.Vertex3(1,0, -1);
185 | GL.End();
186 | GL.PopMatrix();
187 | }
188 | }
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress(gameInstance, progress) {
2 | if (!gameInstance.Module)
3 | return;
4 | if (!gameInstance.logo) {
5 | gameInstance.logo = document.createElement("div");
6 | gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle;
7 | gameInstance.container.appendChild(gameInstance.logo);
8 | }
9 | if (!gameInstance.progress) {
10 | gameInstance.progress = document.createElement("div");
11 | gameInstance.progress.className = "progress " + gameInstance.Module.splashScreenStyle;
12 | gameInstance.progress.empty = document.createElement("div");
13 | gameInstance.progress.empty.className = "empty";
14 | gameInstance.progress.appendChild(gameInstance.progress.empty);
15 | gameInstance.progress.full = document.createElement("div");
16 | gameInstance.progress.full.className = "full";
17 | gameInstance.progress.appendChild(gameInstance.progress.full);
18 | gameInstance.container.appendChild(gameInstance.progress);
19 | }
20 | gameInstance.progress.full.style.width = (100 * progress) + "%";
21 | gameInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
22 | if (progress == 1)
23 | gameInstance.logo.style.display = gameInstance.progress.style.display = "none";
24 | }
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/progressEmpty.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/progressEmpty.Dark.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/progressEmpty.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/progressEmpty.Light.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/progressFull.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/progressFull.Dark.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/progressFull.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/progressFull.Light.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/progressLogo.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/progressLogo.Dark.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/progressLogo.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/progressLogo.Light.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | .webgl-content * {border: 0; margin: 0; padding: 0}
2 | .webgl-content {position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
3 |
4 | .webgl-content .logo, .progress {position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
5 | .webgl-content .logo {background: url('progressLogo.Light.png') no-repeat center / contain; width: 154px; height: 130px;}
6 | .webgl-content .progress {height: 18px; width: 141px; margin-top: 90px;}
7 | .webgl-content .progress .empty {background: url('progressEmpty.Light.png') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;}
8 | .webgl-content .progress .full {background: url('progressFull.Light.png') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;}
9 |
10 | .webgl-content .logo.Dark {background-image: url('progressLogo.Dark.png');}
11 | .webgl-content .progress.Dark .empty {background-image: url('progressEmpty.Dark.png');}
12 | .webgl-content .progress.Dark .full {background-image: url('progressFull.Dark.png');}
13 |
14 | .webgl-content .footer {margin-top: 5px; height: 38px; line-height: 38px; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 18px;}
15 | .webgl-content .footer .webgl-logo, .title, .fullscreen {height: 100%; display: inline-block; background: transparent center no-repeat;}
16 | .webgl-content .footer .webgl-logo {background-image: url('webgl-logo.png'); width: 204px; float: left;}
17 | .webgl-content .footer .title {margin-right: 10px; float: right;}
18 | .webgl-content .footer .fullscreen {background-image: url('fullscreen.png'); width: 38px; float: right;}
--------------------------------------------------------------------------------
/ExpressionParserWebGL/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ExpressionParserWebGL/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/ExpressionParserWebGL/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | ExpressionParserTest
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/GraphCalc/Build/GraphCalc.data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/Build/GraphCalc.data
--------------------------------------------------------------------------------
/GraphCalc/Build/GraphCalc.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/Build/GraphCalc.wasm
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/MemoryProfiler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/MemoryProfiler.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/fullscreen-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/fullscreen-button.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/progress-bar-empty-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/progress-bar-empty-dark.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/progress-bar-empty-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/progress-bar-empty-light.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/progress-bar-full-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/progress-bar-full-dark.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/progress-bar-full-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/progress-bar-full-light.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0 }
2 | #unity-container { position: absolute }
3 | #unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4 | #unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
5 | #unity-canvas { background: #231F20 }
6 | .unity-mobile #unity-canvas { width: 100%; height: 100% }
7 | #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8 | #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9 | #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 }
10 | #unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11 | #unity-footer { position: relative }
12 | .unity-mobile #unity-footer { display: none }
13 | #unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14 | #unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15 | #unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16 | #unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
17 |
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/unity-logo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/unity-logo-dark.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/unity-logo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/unity-logo-light.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/GraphCalc/TemplateData/webmemd-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/GraphCalc/TemplateData/webmemd-icon.png
--------------------------------------------------------------------------------
/GraphCalc/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | GraphCalc
7 |
8 |
9 |
10 |
11 |
26 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/Hanoi/Build/build.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/Build/build.data.unityweb
--------------------------------------------------------------------------------
/Hanoi/Build/build.json:
--------------------------------------------------------------------------------
1 | {
2 | "companyName": "B83",
3 | "productName": "Hanoi",
4 | "productVersion": "0.1",
5 | "dataUrl": "build.data.unityweb",
6 | "wasmCodeUrl": "build.wasm.code.unityweb",
7 | "wasmFrameworkUrl": "build.wasm.framework.unityweb",
8 | "graphicsAPI": ["WebGL 2.0","WebGL 1.0"],
9 | "webglContextAttributes": {"preserveDrawingBuffer": false},
10 | "splashScreenStyle": "Dark",
11 | "backgroundColor": "#231F20",
12 | "cacheControl": {"default": "must-revalidate"},
13 | "developmentBuild": false,
14 | "multithreading": false,
15 | "unityVersion": "2019.1.10f1"
16 | }
--------------------------------------------------------------------------------
/Hanoi/Build/build.wasm.code.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/Build/build.wasm.code.unityweb
--------------------------------------------------------------------------------
/Hanoi/Build/build.wasm.framework.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/Build/build.wasm.framework.unityweb
--------------------------------------------------------------------------------
/Hanoi/Hanoi.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public enum GameState
6 | {
7 | Menu,
8 | Running,
9 | EndGame
10 | }
11 |
12 | public class Hanoi : MonoBehaviour
13 | {
14 | Queue keyQueue = new Queue();
15 | IEnumerator ReadNextKey(System.Action aOnKey)
16 | {
17 | while (keyQueue.Count == 0)
18 | yield return null;
19 | aOnKey(keyQueue.Dequeue());
20 | }
21 | float val = 5;
22 | GameState state = GameState.Menu;
23 | private void OnGUI()
24 | {
25 | Event e = Event.current;
26 | if (e.type == EventType.KeyDown && e.keyCode != KeyCode.None)
27 | keyQueue.Enqueue(e.keyCode);
28 | if (state == GameState.Menu)
29 | {
30 | GUILayout.BeginArea(new Rect(10, 10, 400, 70),"", "box");
31 | val = GUILayout.HorizontalSlider(val, 1, 20);
32 | int d = Mathf.RoundToInt(val);
33 | GUILayout.Label("Discs: " + d + " required moves: " + ((1 << d) - 1));
34 | if(GUILayout.Button("Start"))
35 | StartCoroutine(GameLoop(d));
36 | GUILayout.EndArea();
37 | }
38 | else if(state == GameState.Running)
39 | {
40 | GUILayout.BeginArea(new Rect(10, 5, 400, 35), "", "box");
41 | GUILayout.BeginHorizontal();
42 | if (GUILayout.Button("Abort", GUILayout.Width(60)))
43 | {
44 | StopAllCoroutines();
45 | state = GameState.Menu;
46 | }
47 | GUILayout.Label("Required: " + ((1 << discCount) - 1) + " moves: " + moveCount);
48 | GUILayout.EndHorizontal();
49 | GUILayout.EndArea();
50 | }
51 | else
52 | {
53 | GUILayout.BeginArea(new Rect(0,0,Screen.width, Screen.height));
54 | GUILayout.FlexibleSpace();
55 | GUILayout.BeginHorizontal();
56 | GUILayout.FlexibleSpace();
57 | GUIStyle box = new GUIStyle("box");
58 | box.fontSize = 20;
59 | GUI.contentColor = Color.black;
60 | GUILayout.BeginVertical();
61 | GUILayout.Label("Game Over! took" + moveCount + " moves. " + (moveCount - (1 << discCount) + 1)+" above optimal solution", box);
62 | GUILayout.Label("Press to continue",box);
63 | GUILayout.EndVertical();
64 | GUILayout.FlexibleSpace();
65 | GUILayout.EndHorizontal();
66 | GUILayout.FlexibleSpace();
67 | GUILayout.EndArea();
68 | }
69 | }
70 | public class Disc : System.IDisposable
71 | {
72 | public static float BaseSize = 0.5f;
73 | public static float Growth = 0.3f;
74 | public static float Height = 0.2f;
75 | public static float VerticalSpacing = 0.02f;
76 | public static Color[] colors = new Color[] {new Color(1,0,0), new Color(0, 1, 0), new Color(0, 0, 1), new Color(1, 1, 0), new Color(1, 0, 1), new Color(0, 1, 1)};
77 |
78 | public int Size;
79 | public Transform obj;
80 | public Disc(int aSize)
81 | {
82 | Size = aSize;
83 | obj = GameObject.CreatePrimitive(PrimitiveType.Cylinder).transform;
84 | obj.name = "Disc_" + Size;
85 | float s = BaseSize + Size * Growth;
86 | obj.localScale = new Vector3(s, Height, s);
87 | obj.GetComponent().material.color = colors[Size % colors.Length];
88 | }
89 |
90 | public void Dispose()
91 | {
92 | Destroy(obj.gameObject);
93 | }
94 | }
95 | public Transform[] poles;
96 | public AudioClip pickUpSound;
97 | public AudioClip putDownSound;
98 |
99 | private List[] stacks = new List[3];
100 | private int moveCount = 0;
101 | private int discCount = 0;
102 |
103 | private void Start()
104 | {
105 | for (int i = 0; i < stacks.Length; i++)
106 | stacks[i] = new List();
107 | }
108 |
109 | public void InitGame(int aDiscCount)
110 | {
111 | for (int i = 0; i < stacks.Length; i++)
112 | {
113 | foreach (var d in stacks[i])
114 | d.Dispose();
115 | stacks[i].Clear();
116 | }
117 | for (int i = 0; i < aDiscCount; i++)
118 | stacks[0].Add(new Disc(aDiscCount - i));
119 | discCount = aDiscCount;
120 | moveCount = 0;
121 | }
122 |
123 | void PositionDiscs()
124 | {
125 | float h = Disc.Height*2f + Disc.VerticalSpacing;
126 | for(int i = 0; i < stacks.Length; i++)
127 | {
128 | var p = poles[i];
129 | int count = stacks[i].Count;
130 | for (int n = 0; n < count; n++)
131 | {
132 | stacks[i][n].obj.parent = p;
133 | stacks[i][n].obj.localPosition = n * h * Vector3.up;
134 | }
135 | }
136 | }
137 |
138 | Disc Pop(List aStack)
139 | {
140 | if (aStack.Count <= 0)
141 | return null;
142 | var tmp = aStack[aStack.Count - 1];
143 | aStack.RemoveAt(aStack.Count - 1);
144 | tmp.obj.localPosition = Vector3.up * 9;
145 | AudioSource.PlayClipAtPoint(pickUpSound, Vector3.zero);
146 | return tmp;
147 | }
148 |
149 | void Push(List aStack, ref Disc aCurrent)
150 | {
151 | if (aStack.Count > 0 && aStack[aStack.Count - 1].Size <= aCurrent.Size)
152 | return;
153 | aStack.Add(aCurrent);
154 | aCurrent = null;
155 | AudioSource.PlayClipAtPoint(putDownSound, Vector3.zero);
156 | moveCount++;
157 | PositionDiscs();
158 | }
159 |
160 | IEnumerator GameLoop(int aDiscCount)
161 | {
162 | state = GameState.Running;
163 | InitGame(aDiscCount);
164 | PositionDiscs();
165 | KeyCode key = KeyCode.None;
166 | while (true)
167 | {
168 | Disc current = null;
169 | while (current == null)
170 | {
171 | yield return ReadNextKey(k => key = k);
172 | switch (key)
173 | {
174 | case KeyCode.Alpha1:
175 | case KeyCode.Keypad1:
176 | current = Pop(stacks[0]); break;
177 | case KeyCode.Alpha2:
178 | case KeyCode.Keypad2:
179 | current = Pop(stacks[1]); break;
180 | case KeyCode.Alpha3:
181 | case KeyCode.Keypad3:
182 | current = Pop(stacks[2]); break;
183 | }
184 | }
185 | while (current != null)
186 | {
187 | yield return ReadNextKey(k => key = k);
188 | switch (key)
189 | {
190 | case KeyCode.Alpha1:
191 | case KeyCode.Keypad1:
192 | Push(stacks[0], ref current); break;
193 | case KeyCode.Alpha2:
194 | case KeyCode.Keypad2:
195 | Push(stacks[1], ref current); break;
196 | case KeyCode.Alpha3:
197 | case KeyCode.Keypad3:
198 | Push(stacks[2], ref current); break;
199 | }
200 | }
201 | if (stacks[0].Count == 0)
202 | {
203 | if (stacks[1].Count == 0 || stacks[2].Count == 0)
204 | {
205 | Debug.Log("Game over! Took " + moveCount +" moves. Required moves: " + ((1< key = k);
213 | state = GameState.Menu;
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/Hanoi/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress(unityInstance, progress) {
2 | if (!unityInstance.Module)
3 | return;
4 | if (!unityInstance.logo) {
5 | unityInstance.logo = document.createElement("div");
6 | unityInstance.logo.className = "logo " + unityInstance.Module.splashScreenStyle;
7 | unityInstance.container.appendChild(unityInstance.logo);
8 | }
9 | if (!unityInstance.progress) {
10 | unityInstance.progress = document.createElement("div");
11 | unityInstance.progress.className = "progress " + unityInstance.Module.splashScreenStyle;
12 | unityInstance.progress.empty = document.createElement("div");
13 | unityInstance.progress.empty.className = "empty";
14 | unityInstance.progress.appendChild(unityInstance.progress.empty);
15 | unityInstance.progress.full = document.createElement("div");
16 | unityInstance.progress.full.className = "full";
17 | unityInstance.progress.appendChild(unityInstance.progress.full);
18 | unityInstance.container.appendChild(unityInstance.progress);
19 | }
20 | unityInstance.progress.full.style.width = (100 * progress) + "%";
21 | unityInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
22 | if (progress == 1)
23 | unityInstance.logo.style.display = unityInstance.progress.style.display = "none";
24 | }
--------------------------------------------------------------------------------
/Hanoi/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/Hanoi/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/Hanoi/TemplateData/progressEmpty.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/progressEmpty.Dark.png
--------------------------------------------------------------------------------
/Hanoi/TemplateData/progressEmpty.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/progressEmpty.Light.png
--------------------------------------------------------------------------------
/Hanoi/TemplateData/progressFull.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/progressFull.Dark.png
--------------------------------------------------------------------------------
/Hanoi/TemplateData/progressFull.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/progressFull.Light.png
--------------------------------------------------------------------------------
/Hanoi/TemplateData/progressLogo.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/progressLogo.Dark.png
--------------------------------------------------------------------------------
/Hanoi/TemplateData/progressLogo.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/progressLogo.Light.png
--------------------------------------------------------------------------------
/Hanoi/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | .webgl-content * {border: 0; margin: 0; padding: 0}
2 | .webgl-content {position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
3 |
4 | .webgl-content .logo, .progress {position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
5 | .webgl-content .logo {background: url('progressLogo.Light.png') no-repeat center / contain; width: 154px; height: 130px;}
6 | .webgl-content .progress {height: 18px; width: 141px; margin-top: 90px;}
7 | .webgl-content .progress .empty {background: url('progressEmpty.Light.png') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;}
8 | .webgl-content .progress .full {background: url('progressFull.Light.png') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;}
9 |
10 | .webgl-content .logo.Dark {background-image: url('progressLogo.Dark.png');}
11 | .webgl-content .progress.Dark .empty {background-image: url('progressEmpty.Dark.png');}
12 | .webgl-content .progress.Dark .full {background-image: url('progressFull.Dark.png');}
13 |
14 | .webgl-content .footer {margin-top: 5px; height: 38px; line-height: 38px; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 18px;}
15 | .webgl-content .footer .webgl-logo, .title, .fullscreen {height: 100%; display: inline-block; background: transparent center no-repeat;}
16 | .webgl-content .footer .webgl-logo {background-image: url('webgl-logo.png'); width: 204px; float: left;}
17 | .webgl-content .footer .title {margin-right: 10px; float: right;}
18 | .webgl-content .footer .fullscreen {background-image: url('fullscreen.png'); width: 38px; float: right;}
19 |
--------------------------------------------------------------------------------
/Hanoi/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Hanoi/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/Hanoi/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | Hanoi
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/HealthBarExample/Build/HealthBarExample.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/Build/HealthBarExample.data.unityweb
--------------------------------------------------------------------------------
/HealthBarExample/Build/HealthBarExample.framework.js.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/Build/HealthBarExample.framework.js.unityweb
--------------------------------------------------------------------------------
/HealthBarExample/Build/HealthBarExample.wasm.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/Build/HealthBarExample.wasm.unityweb
--------------------------------------------------------------------------------
/HealthBarExample/HealthBarExample.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/HealthBarExample.unitypackage
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/fullscreen-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/fullscreen-button.png
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/progress-bar-empty-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/progress-bar-empty-dark.png
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/progress-bar-empty-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/progress-bar-empty-light.png
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/progress-bar-full-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/progress-bar-full-dark.png
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/progress-bar-full-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/progress-bar-full-light.png
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0 }
2 | #unity-container { position: absolute }
3 | #unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4 | #unity-container.unity-mobile { width: 100%; height: 100% }
5 | #unity-canvas { background: #231F20 }
6 | .unity-mobile #unity-canvas { width: 100%; height: 100% }
7 | #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8 | #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9 | #unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; background: url('progress-bar-empty-dark.png') no-repeat center }
10 | #unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11 | #unity-footer { position: relative }
12 | .unity-mobile #unity-footer { display: none }
13 | #unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14 | #unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15 | #unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16 |
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/unity-logo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/unity-logo-dark.png
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/unity-logo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/unity-logo-light.png
--------------------------------------------------------------------------------
/HealthBarExample/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HealthBarExample/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/HealthBarExample/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | HealthBarExample
7 |
8 |
9 |
10 |
11 |
25 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/HowUnityWorks/Build/WebGL.asm.code.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/Build/WebGL.asm.code.unityweb
--------------------------------------------------------------------------------
/HowUnityWorks/Build/WebGL.asm.framework.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/Build/WebGL.asm.framework.unityweb
--------------------------------------------------------------------------------
/HowUnityWorks/Build/WebGL.asm.memory.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/Build/WebGL.asm.memory.unityweb
--------------------------------------------------------------------------------
/HowUnityWorks/Build/WebGL.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/Build/WebGL.data.unityweb
--------------------------------------------------------------------------------
/HowUnityWorks/Build/WebGL.json:
--------------------------------------------------------------------------------
1 | {
2 | "companyName": "Markus",
3 | "productName": "HowUnityWorks",
4 | "dataUrl": "WebGL.data.unityweb",
5 | "asmCodeUrl": "WebGL.asm.code.unityweb",
6 | "asmMemoryUrl": "WebGL.asm.memory.unityweb",
7 | "asmFrameworkUrl": "WebGL.asm.framework.unityweb",
8 | "TOTAL_MEMORY": 268435456,
9 | "graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],
10 | "webglContextAttributes": {"preserveDrawingBuffer": false},
11 | "splashScreenStyle": "Dark",
12 | "backgroundColor": "#231F20"
13 | }
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress(gameInstance, progress) {
2 | if (!gameInstance.Module)
3 | return;
4 | if (!gameInstance.logo) {
5 | gameInstance.logo = document.createElement("div");
6 | gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle;
7 | gameInstance.container.appendChild(gameInstance.logo);
8 | }
9 | if (!gameInstance.progress) {
10 | gameInstance.progress = document.createElement("div");
11 | gameInstance.progress.className = "progress " + gameInstance.Module.splashScreenStyle;
12 | gameInstance.progress.empty = document.createElement("div");
13 | gameInstance.progress.empty.className = "empty";
14 | gameInstance.progress.appendChild(gameInstance.progress.empty);
15 | gameInstance.progress.full = document.createElement("div");
16 | gameInstance.progress.full.className = "full";
17 | gameInstance.progress.appendChild(gameInstance.progress.full);
18 | gameInstance.container.appendChild(gameInstance.progress);
19 | }
20 | gameInstance.progress.full.style.width = (100 * progress) + "%";
21 | gameInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
22 | if (progress == 1)
23 | gameInstance.logo.style.display = gameInstance.progress.style.display = "none";
24 | }
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/progressEmpty.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/progressEmpty.Dark.png
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/progressEmpty.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/progressEmpty.Light.png
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/progressFull.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/progressFull.Dark.png
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/progressFull.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/progressFull.Light.png
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/progressLogo.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/progressLogo.Dark.png
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/progressLogo.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/progressLogo.Light.png
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0px;
3 | padding: 0px;
4 | }
5 |
6 |
7 | html,body,div,canvas { margin: 0; padding: 0; width: 100%; height: 100%;}
8 |
9 | html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }
10 | canvas { margin: 0 0 0 0; position: absolute; z-index: 9; width: 100%; height: 100%;}
--------------------------------------------------------------------------------
/HowUnityWorks/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/HowUnityWorks/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/HowUnityWorks/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | HowUnityWorks
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ImageShapeDetection/Release/build.datagz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/Release/build.datagz
--------------------------------------------------------------------------------
/ImageShapeDetection/Release/build.jsgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/Release/build.jsgz
--------------------------------------------------------------------------------
/ImageShapeDetection/Release/build.memgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/Release/build.memgz
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress (dom) {
2 | this.progress = 0.0;
3 | this.message = "";
4 | this.dom = dom;
5 |
6 | var parent = dom.parentNode;
7 |
8 | var background = document.createElement("div");
9 | background.style.background = "#4D4D4D";
10 | background.style.position = "absolute";
11 | parent.appendChild(background);
12 | this.background = background;
13 |
14 | var logoImage = document.createElement("img");
15 | logoImage.src = "TemplateData/progresslogo.png";
16 | logoImage.style.position = "absolute";
17 | parent.appendChild(logoImage);
18 | this.logoImage = logoImage;
19 |
20 | var progressFrame = document.createElement("img");
21 | progressFrame.src = "TemplateData/loadingbar.png";
22 | progressFrame.style.position = "absolute";
23 | parent.appendChild(progressFrame);
24 | this.progressFrame = progressFrame;
25 |
26 | var progressBar = document.createElement("img");
27 | progressBar.src = "TemplateData/fullbar.png";
28 | progressBar.style.position = "absolute";
29 | parent.appendChild(progressBar);
30 | this.progressBar = progressBar;
31 |
32 | var messageArea = document.createElement("p");
33 | messageArea.style.position = "absolute";
34 | parent.appendChild(messageArea);
35 | this.messageArea = messageArea;
36 |
37 |
38 | this.SetProgress = function (progress) {
39 | if (this.progress < progress)
40 | this.progress = progress;
41 | this.messageArea.style.display = "none";
42 | this.progressFrame.style.display = "inline";
43 | this.progressBar.style.display = "inline";
44 | this.Update();
45 | }
46 |
47 | this.SetMessage = function (message) {
48 | this.message = message;
49 | this.background.style.display = "inline";
50 | this.logoImage.style.display = "inline";
51 | this.progressFrame.style.display = "none";
52 | this.progressBar.style.display = "none";
53 | this.Update();
54 | }
55 |
56 | this.Clear = function() {
57 | this.background.style.display = "none";
58 | this.logoImage.style.display = "none";
59 | this.progressFrame.style.display = "none";
60 | this.progressBar.style.display = "none";
61 | }
62 |
63 | this.Update = function() {
64 | this.background.style.top = this.dom.offsetTop + 'px';
65 | this.background.style.left = this.dom.offsetLeft + 'px';
66 | this.background.style.width = this.dom.offsetWidth + 'px';
67 | this.background.style.height = this.dom.offsetHeight + 'px';
68 |
69 | var logoImg = new Image();
70 | logoImg.src = this.logoImage.src;
71 | var progressFrameImg = new Image();
72 | progressFrameImg.src = this.progressFrame.src;
73 |
74 | this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px';
75 | this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px';
76 | this.logoImage.style.width = logoImg.width+'px';
77 | this.logoImage.style.height = logoImg.height+'px';
78 |
79 | this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px';
80 | this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px';
81 | this.progressFrame.width = progressFrameImg.width;
82 | this.progressFrame.height = progressFrameImg.height;
83 |
84 | this.progressBar.style.top = this.progressFrame.style.top;
85 | this.progressBar.style.left = this.progressFrame.style.left;
86 | this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1);
87 | this.progressBar.height = progressFrameImg.height;
88 |
89 | this.messageArea.style.top = this.progressFrame.style.top;
90 | this.messageArea.style.left = 0;
91 | this.messageArea.style.width = '100%';
92 | this.messageArea.style.textAlign = 'center';
93 | this.messageArea.innerHTML = this.message;
94 | }
95 |
96 | this.Update ();
97 | }
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/fullbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/TemplateData/fullbar.png
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/loadingbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/TemplateData/loadingbar.png
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/TemplateData/logo.png
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/progresslogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/ImageShapeDetection/TemplateData/progresslogo.png
--------------------------------------------------------------------------------
/ImageShapeDetection/TemplateData/style.css:
--------------------------------------------------------------------------------
1 |
2 | /****************************************
3 | ==== RESETS
4 | ****************************************/
5 |
6 | html,body,div,canvas { margin: 0; padding: 0; }
7 | ::-moz-selection { color: #333; text-shadow: none; }
8 | ::selection { color: #333; text-shadow: none; }
9 | .clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
10 | .clear { display: inline-table; clear: both; }
11 | /* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */
12 |
13 | /****************************************
14 | ==== LAYOUT
15 | ****************************************/
16 |
17 | html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }
18 | body { }
19 | p.header, p.footer { display: none; }
20 | div.logo { width: 204px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; }
21 | div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; }
22 | .template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }
23 | .template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
24 | .fullscreen { float: right; position: relative; z-index: 10; }
25 |
26 | body.template { }
27 | .template .template-wrap { }
28 | .template .template-wrap canvas { }
29 |
--------------------------------------------------------------------------------
/ImageShapeDetection/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | ImageShapeDetect
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
ImageShapeDetect
19 |
20 |
21 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/InfiniteZoomExample/Build/WebGL.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/Build/WebGL.data.unityweb
--------------------------------------------------------------------------------
/InfiniteZoomExample/Build/WebGL.json:
--------------------------------------------------------------------------------
1 | {
2 | "companyName": "B83",
3 | "productName": "TestUA",
4 | "productVersion": "0.1",
5 | "dataUrl": "WebGL.data.unityweb",
6 | "wasmCodeUrl": "WebGL.wasm.code.unityweb",
7 | "wasmFrameworkUrl": "WebGL.wasm.framework.unityweb",
8 | "graphicsAPI": ["WebGL 2.0","WebGL 1.0"],
9 | "webglContextAttributes": {"preserveDrawingBuffer": false},
10 | "splashScreenStyle": "Dark",
11 | "backgroundColor": "#231F20",
12 | "cacheControl": {"default": "must-revalidate"},
13 | "developmentBuild": false,
14 | "multithreading": false,
15 | "unityVersion": "2019.2.14f1"
16 | }
--------------------------------------------------------------------------------
/InfiniteZoomExample/Build/WebGL.wasm.code.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/Build/WebGL.wasm.code.unityweb
--------------------------------------------------------------------------------
/InfiniteZoomExample/Build/WebGL.wasm.framework.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/Build/WebGL.wasm.framework.unityweb
--------------------------------------------------------------------------------
/InfiniteZoomExample/InfiniteZoomPack.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/InfiniteZoomPack.unitypackage
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress(unityInstance, progress) {
2 | if (!unityInstance.Module)
3 | return;
4 | if (!unityInstance.logo) {
5 | unityInstance.logo = document.createElement("div");
6 | unityInstance.logo.className = "logo " + unityInstance.Module.splashScreenStyle;
7 | unityInstance.container.appendChild(unityInstance.logo);
8 | }
9 | if (!unityInstance.progress) {
10 | unityInstance.progress = document.createElement("div");
11 | unityInstance.progress.className = "progress " + unityInstance.Module.splashScreenStyle;
12 | unityInstance.progress.empty = document.createElement("div");
13 | unityInstance.progress.empty.className = "empty";
14 | unityInstance.progress.appendChild(unityInstance.progress.empty);
15 | unityInstance.progress.full = document.createElement("div");
16 | unityInstance.progress.full.className = "full";
17 | unityInstance.progress.appendChild(unityInstance.progress.full);
18 | unityInstance.container.appendChild(unityInstance.progress);
19 | }
20 | unityInstance.progress.full.style.width = (100 * progress) + "%";
21 | unityInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
22 | if (progress == 1)
23 | unityInstance.logo.style.display = unityInstance.progress.style.display = "none";
24 | }
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/progressEmpty.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/progressEmpty.Dark.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/progressEmpty.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/progressEmpty.Light.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/progressFull.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/progressFull.Dark.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/progressFull.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/progressFull.Light.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/progressLogo.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/progressLogo.Dark.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/progressLogo.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/progressLogo.Light.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | .webgl-content * {border: 0; margin: 0; padding: 0}
2 | .webgl-content {position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
3 |
4 | .webgl-content .logo, .progress {position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
5 | .webgl-content .logo {background: url('progressLogo.Light.png') no-repeat center / contain; width: 154px; height: 130px;}
6 | .webgl-content .progress {height: 18px; width: 141px; margin-top: 90px;}
7 | .webgl-content .progress .empty {background: url('progressEmpty.Light.png') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;}
8 | .webgl-content .progress .full {background: url('progressFull.Light.png') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;}
9 |
10 | .webgl-content .logo.Dark {background-image: url('progressLogo.Dark.png');}
11 | .webgl-content .progress.Dark .empty {background-image: url('progressEmpty.Dark.png');}
12 | .webgl-content .progress.Dark .full {background-image: url('progressFull.Dark.png');}
13 |
14 | .webgl-content .footer {margin-top: 5px; height: 38px; line-height: 38px; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 18px;}
15 | .webgl-content .footer .webgl-logo, .title, .fullscreen {height: 100%; display: inline-block; background: transparent center no-repeat;}
16 | .webgl-content .footer .webgl-logo {background-image: url('webgl-logo.png'); width: 204px; float: left;}
17 | .webgl-content .footer .title {margin-right: 10px; float: right;}
18 | .webgl-content .footer .fullscreen {background-image: url('fullscreen.png'); width: 38px; float: right;}
19 |
--------------------------------------------------------------------------------
/InfiniteZoomExample/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InfiniteZoomExample/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/InfiniteZoomExample/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | TestUA
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/InterceptExample/Build/build.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/Build/build.data.unityweb
--------------------------------------------------------------------------------
/InterceptExample/Build/build.json:
--------------------------------------------------------------------------------
1 | {
2 | "companyName": "B83",
3 | "productName": "InterceptExample",
4 | "productVersion": "0.1",
5 | "dataUrl": "build.data.unityweb",
6 | "wasmCodeUrl": "build.wasm.code.unityweb",
7 | "wasmFrameworkUrl": "build.wasm.framework.unityweb",
8 | "graphicsAPI": ["WebGL 2.0","WebGL 1.0"],
9 | "webglContextAttributes": {"preserveDrawingBuffer": false},
10 | "splashScreenStyle": "Dark",
11 | "backgroundColor": "#231F20",
12 | "cacheControl": {"default": "must-revalidate"},
13 | "developmentBuild": false,
14 | "multithreading": false,
15 | "unityVersion": "2019.3.0f6"
16 | }
--------------------------------------------------------------------------------
/InterceptExample/Build/build.wasm.code.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/Build/build.wasm.code.unityweb
--------------------------------------------------------------------------------
/InterceptExample/Build/build.wasm.framework.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/Build/build.wasm.framework.unityweb
--------------------------------------------------------------------------------
/InterceptExample/Intercept.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/Intercept.unitypackage
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress(unityInstance, progress) {
2 | if (!unityInstance.Module)
3 | return;
4 | if (!unityInstance.logo) {
5 | unityInstance.logo = document.createElement("div");
6 | unityInstance.logo.className = "logo " + unityInstance.Module.splashScreenStyle;
7 | unityInstance.container.appendChild(unityInstance.logo);
8 | }
9 | if (!unityInstance.progress) {
10 | unityInstance.progress = document.createElement("div");
11 | unityInstance.progress.className = "progress " + unityInstance.Module.splashScreenStyle;
12 | unityInstance.progress.empty = document.createElement("div");
13 | unityInstance.progress.empty.className = "empty";
14 | unityInstance.progress.appendChild(unityInstance.progress.empty);
15 | unityInstance.progress.full = document.createElement("div");
16 | unityInstance.progress.full.className = "full";
17 | unityInstance.progress.appendChild(unityInstance.progress.full);
18 | unityInstance.container.appendChild(unityInstance.progress);
19 | }
20 | unityInstance.progress.full.style.width = (100 * progress) + "%";
21 | unityInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
22 | if (progress == 1)
23 | unityInstance.logo.style.display = unityInstance.progress.style.display = "none";
24 | }
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/progressEmpty.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/progressEmpty.Dark.png
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/progressEmpty.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/progressEmpty.Light.png
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/progressFull.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/progressFull.Dark.png
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/progressFull.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/progressFull.Light.png
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/progressLogo.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/progressLogo.Dark.png
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/progressLogo.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/progressLogo.Light.png
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | .webgl-content * {border: 0; margin: 0; padding: 0}
2 | .webgl-content {position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
3 |
4 | .webgl-content .logo, .progress {position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
5 | .webgl-content .logo {background: url('progressLogo.Light.png') no-repeat center / contain; width: 154px; height: 130px;}
6 | .webgl-content .progress {height: 18px; width: 141px; margin-top: 90px;}
7 | .webgl-content .progress .empty {background: url('progressEmpty.Light.png') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;}
8 | .webgl-content .progress .full {background: url('progressFull.Light.png') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;}
9 |
10 | .webgl-content .logo.Dark {background-image: url('progressLogo.Dark.png');}
11 | .webgl-content .progress.Dark .empty {background-image: url('progressEmpty.Dark.png');}
12 | .webgl-content .progress.Dark .full {background-image: url('progressFull.Dark.png');}
13 |
14 | .webgl-content .footer {margin-top: 5px; height: 38px; line-height: 38px; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 18px;}
15 | .webgl-content .footer .webgl-logo, .title, .fullscreen {height: 100%; display: inline-block; background: transparent center no-repeat;}
16 | .webgl-content .footer .webgl-logo {background-image: url('webgl-logo.png'); width: 204px; float: left;}
17 | .webgl-content .footer .title {margin-right: 10px; float: right;}
18 | .webgl-content .footer .fullscreen {background-image: url('fullscreen.png'); width: 38px; float: right;}
19 |
--------------------------------------------------------------------------------
/InterceptExample/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/InterceptExample/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/InterceptExample/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | InterceptExample
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Mandelbrot/MandelbrotVisualizer.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class Mandelbrot
6 | {
7 | public static int maxIter = 15000;
8 | public static double log2 = System.Math.Log(2);
9 | public static double log4 = System.Math.Log(4);
10 | public static double startR = 0;
11 | public static double startI = 0;
12 |
13 | // julia set
14 | /*public static int Calc(double x, double y)
15 | {
16 | double x1 = x;
17 | double y1 = y;
18 | double x2 = 0;
19 | double y2 = 0;
20 | double mag = 0;
21 | for (int i = 0; i < maxIter; i++)
22 | {
23 | x2 = x1*x1 -y1*y1 + startR;
24 | y2 = 2*x1*y1 + startI;
25 | x1 = x2;
26 | y1 = y2;
27 | mag = x1*x1 +y1*y1;
28 | if (mag > 4d)
29 | {
30 | return i;// – System.Math.Log(System.Math.Log(mag)/log4)/log2;
31 | }
32 |
33 | }
34 | return maxIter;
35 |
36 | }*/
37 | // mandelbrot set
38 | public static int Calc(double x, double y)
39 | {
40 | double x1 = startR;
41 | double y1 = startI;
42 | double x2 = 0;
43 | double y2 = 0;
44 | double mag = 0;
45 | for (int i = 0; i < maxIter; i++)
46 | {
47 | x2 = x1*x1 -y1*y1 + x;
48 | y2 = 2*x1*y1 + y;
49 | x1 = x2;
50 | y1 = y2;
51 | mag = x1*x1 +y1*y1;
52 | if (mag > 4d)
53 | {
54 | return i;// – System.Math.Log(System.Math.Log(mag)/log4)/log2;
55 | }
56 |
57 | }
58 | return maxIter;
59 |
60 | }
61 | public static IEnumerable CalcPoints(double x, double y)
62 | {
63 | double x1 = startR;
64 | double y1 = startI;
65 | double x2 = 0;
66 | double y2 = 0;
67 | double mag = 0;
68 | yield return new Vector2((float)x,(float)y);
69 | for (int i = 0; i < maxIter; i++)
70 | {
71 | x2 = x1*x1 -y1*y1 + x;
72 | y2 = 2*x1*y1 + y;
73 | x1 = x2;
74 | y1 = y2;
75 | mag = x1*x1 +y1*y1;
76 | yield return new Vector2((float)x1,(float)y1);
77 | if (mag > 4d)
78 | {
79 | //yield break;
80 | }
81 |
82 | }
83 | }
84 | }
85 |
86 |
87 | public class MandelbrotVisualizer : MonoBehaviour
88 | {
89 | Texture2D tex;
90 | Material m;
91 | public Vector3 test;
92 | int xSize = 800;
93 | int ySize = 800;
94 | public Color[] colors = new Color[]
95 | {
96 | Color.clear,
97 | Color.grey,
98 | Color.green,
99 | Color.red,
100 | Color.blue,
101 | Color.yellow,
102 | Color.cyan,
103 | Color.white,
104 | Color.black
105 | };
106 | void Start ()
107 | {
108 | tex = new Texture2D(xSize,ySize);
109 | m = new Material("Shader \"LineShader\" { SubShader { Pass { Lighting Off Blend SrcAlpha OneMinusSrcAlpha BindChannels { Bind \"Color\", color} } } }");
110 |
111 |
112 | }
113 | Vector2 pos = Vector2.zero;
114 | int iterations = 0;
115 | void OnGUI ()
116 | {
117 | GUILayout.BeginHorizontal();
118 | if (GUILayout.Button("render"))
119 | {
120 | Color[] cols = new Color[xSize*ySize];
121 | Mandelbrot.maxIter = 150;
122 | for(int y = 0; y < ySize; y++)
123 | {
124 | int off = y * xSize;
125 | for(int x = 0; x < xSize; x++)
126 | {
127 | float v = (float)Mandelbrot.Calc(-3d+(double)x*4/(xSize),-1.5d+(double)y*3/(ySize))/10;
128 | var i1 = Mathf.Clamp(Mathf.FloorToInt(v),0,colors.Length-1);
129 | var i2 = Mathf.Clamp(Mathf.CeilToInt(v),0,colors.Length-1);
130 | cols[off + x] = Color.Lerp(colors[i1], colors[i2],v - i1);
131 | }
132 | }
133 | tex.SetPixels(cols);
134 | tex.Apply();
135 | Mandelbrot.maxIter = 30000;
136 | }
137 | GUILayout.Label("point: (" + pos.x.ToString("0.00000") + " + " + pos.y.ToString("0.00000")+"*i) interations: " + iterations);
138 | GUILayout.EndHorizontal();
139 | GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
140 | /*
141 | Mandelbrot.startR = GUILayout.HorizontalSlider((float)Mandelbrot.startR,-1,1);
142 | Mandelbrot.startI = GUILayout.HorizontalSlider((float)Mandelbrot.startI,-1,1);
143 | */
144 | GUILayout.EndHorizontal();
145 |
146 | Rect r = new Rect(10,50,xSize,ySize);
147 | GUI.DrawTexture(r,tex);
148 | GUI.BeginGroup(r);
149 | Event e = Event.current;
150 | if (e.type == EventType.MouseDrag || e.type == EventType.MouseDown)
151 | {
152 | pos = e.mousePosition;
153 | pos.x = pos.x*4 / xSize - 3;
154 | pos.y = pos.y*3 / ySize - 1.5f;
155 | iterations = Mandelbrot.Calc(pos.x, pos.y);
156 | }
157 | GUI.EndGroup();
158 | if (Event.current.type == EventType.Repaint)
159 | {
160 | r.y = Screen.height - r.yMax;
161 | GL.Viewport(r);
162 | GL.LoadPixelMatrix(-3,1,1.5f,-1.5f);
163 | Vector2 old = pos;
164 | GL.Begin(GL.LINES);
165 | m.SetPass(0);
166 | GL.Color(Color.blue);
167 | GL.Vertex3(-3,0,0);
168 | GL.Vertex3(1,0,0);
169 | GL.Vertex3(0,-1,0);
170 | GL.Vertex3(0,1,0);
171 |
172 | GL.Color(Color.red);
173 | foreach(var p in Mandelbrot.CalcPoints(pos.x, pos.y))
174 | {
175 | GL.Vertex(old);
176 | GL.Vertex(p);
177 | old = p;
178 | }
179 | GL.End();
180 |
181 | }
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/Mandelbrot/Release/URL.txt:
--------------------------------------------------------------------------------
1 | https://dl.dropboxusercontent.com/u/7761356/UnityAnswers/Web/Mandelbrot/WebGL/index.html
--------------------------------------------------------------------------------
/Mandelbrot/Release/WebGL.datagz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/Release/WebGL.datagz
--------------------------------------------------------------------------------
/Mandelbrot/Release/WebGL.jsgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/Release/WebGL.jsgz
--------------------------------------------------------------------------------
/Mandelbrot/Release/WebGL.memgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/Release/WebGL.memgz
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress (dom) {
2 | this.progress = 0.0;
3 | this.message = "";
4 | this.dom = dom;
5 |
6 | var parent = dom.parentNode;
7 |
8 | var background = document.createElement("div");
9 | background.style.background = "#4D4D4D";
10 | background.style.position = "absolute";
11 | parent.appendChild(background);
12 | this.background = background;
13 |
14 | var logoImage = document.createElement("img");
15 | logoImage.src = "TemplateData/progresslogo.png";
16 | logoImage.style.position = "absolute";
17 | parent.appendChild(logoImage);
18 | this.logoImage = logoImage;
19 |
20 | var progressFrame = document.createElement("img");
21 | progressFrame.src = "TemplateData/loadingbar.png";
22 | progressFrame.style.position = "absolute";
23 | parent.appendChild(progressFrame);
24 | this.progressFrame = progressFrame;
25 |
26 | var progressBar = document.createElement("img");
27 | progressBar.src = "TemplateData/fullbar.png";
28 | progressBar.style.position = "absolute";
29 | parent.appendChild(progressBar);
30 | this.progressBar = progressBar;
31 |
32 | var messageArea = document.createElement("p");
33 | messageArea.style.position = "absolute";
34 | parent.appendChild(messageArea);
35 | this.messageArea = messageArea;
36 |
37 |
38 | this.SetProgress = function (progress) {
39 | if (this.progress < progress)
40 | this.progress = progress;
41 | this.messageArea.style.display = "none";
42 | this.progressFrame.style.display = "inline";
43 | this.progressBar.style.display = "inline";
44 | this.Update();
45 | }
46 |
47 | this.SetMessage = function (message) {
48 | this.message = message;
49 | this.background.style.display = "inline";
50 | this.logoImage.style.display = "inline";
51 | this.progressFrame.style.display = "none";
52 | this.progressBar.style.display = "none";
53 | this.Update();
54 | }
55 |
56 | this.Clear = function() {
57 | this.background.style.display = "none";
58 | this.logoImage.style.display = "none";
59 | this.progressFrame.style.display = "none";
60 | this.progressBar.style.display = "none";
61 | }
62 |
63 | this.Update = function() {
64 | this.background.style.top = this.dom.offsetTop + 'px';
65 | this.background.style.left = this.dom.offsetLeft + 'px';
66 | this.background.style.width = this.dom.offsetWidth + 'px';
67 | this.background.style.height = this.dom.offsetHeight + 'px';
68 |
69 | var logoImg = new Image();
70 | logoImg.src = this.logoImage.src;
71 | var progressFrameImg = new Image();
72 | progressFrameImg.src = this.progressFrame.src;
73 |
74 | this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px';
75 | this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px';
76 | this.logoImage.style.width = logoImg.width+'px';
77 | this.logoImage.style.height = logoImg.height+'px';
78 |
79 | this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px';
80 | this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px';
81 | this.progressFrame.width = progressFrameImg.width;
82 | this.progressFrame.height = progressFrameImg.height;
83 |
84 | this.progressBar.style.top = this.progressFrame.style.top;
85 | this.progressBar.style.left = this.progressFrame.style.left;
86 | this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1);
87 | this.progressBar.height = progressFrameImg.height;
88 |
89 | this.messageArea.style.top = this.progressFrame.style.top;
90 | this.messageArea.style.left = 0;
91 | this.messageArea.style.width = '100%';
92 | this.messageArea.style.textAlign = 'center';
93 | this.messageArea.innerHTML = this.message;
94 | }
95 |
96 | this.Update ();
97 | }
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/fullbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/TemplateData/fullbar.png
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/loadingbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/TemplateData/loadingbar.png
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/TemplateData/logo.png
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/progresslogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/TemplateData/progresslogo.png
--------------------------------------------------------------------------------
/Mandelbrot/TemplateData/style.css:
--------------------------------------------------------------------------------
1 |
2 | /****************************************
3 | ==== RESETS
4 | ****************************************/
5 |
6 | html,body,div,canvas { margin: 0; padding: 0; }
7 | ::-moz-selection { color: #333; text-shadow: none; }
8 | ::selection { color: #333; text-shadow: none; }
9 | .clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
10 | .clear { display: inline-table; clear: both; }
11 | /* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */
12 |
13 | /****************************************
14 | ==== LAYOUT
15 | ****************************************/
16 |
17 | html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }
18 | body { }
19 | p.header, p.footer { display: none; }
20 | div.logo { width: 204px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; }
21 | div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; }
22 | .template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }
23 | .template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
24 | .fullscreen { float: right; position: relative; z-index: 10; }
25 |
26 | body.template { }
27 | .template .template-wrap { }
28 | .template .template-wrap canvas { }
29 |
--------------------------------------------------------------------------------
/Mandelbrot/URLParameters.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Mandelbrot/URLParameters.cs
--------------------------------------------------------------------------------
/Mandelbrot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | MobileMandel
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
MobileMandel
19 |
20 |
21 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/MaskShader/Build/WebGL.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/Build/WebGL.data.unityweb
--------------------------------------------------------------------------------
/MaskShader/Build/WebGL.json:
--------------------------------------------------------------------------------
1 | {
2 | "companyName": "DefaultCompany",
3 | "productName": "MaskShader",
4 | "dataUrl": "WebGL.data.unityweb",
5 | "wasmCodeUrl": "WebGL.wasm.code.unityweb",
6 | "wasmFrameworkUrl": "WebGL.wasm.framework.unityweb",
7 | "TOTAL_MEMORY": 268435456,
8 | "graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],
9 | "webglContextAttributes": {"preserveDrawingBuffer": false},
10 | "splashScreenStyle": "Dark",
11 | "backgroundColor": "#231F20",
12 | "cacheControl": {"default": "must-revalidate"}
13 | }
--------------------------------------------------------------------------------
/MaskShader/Build/WebGL.wasm.code.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/Build/WebGL.wasm.code.unityweb
--------------------------------------------------------------------------------
/MaskShader/Build/WebGL.wasm.framework.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/Build/WebGL.wasm.framework.unityweb
--------------------------------------------------------------------------------
/MaskShader/MaskShaderExample.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/MaskShaderExample.unitypackage
--------------------------------------------------------------------------------
/MaskShader/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress(gameInstance, progress) {
2 | if (!gameInstance.Module)
3 | return;
4 | if (!gameInstance.logo) {
5 | gameInstance.logo = document.createElement("div");
6 | gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle;
7 | gameInstance.container.appendChild(gameInstance.logo);
8 | }
9 | if (!gameInstance.progress) {
10 | gameInstance.progress = document.createElement("div");
11 | gameInstance.progress.className = "progress " + gameInstance.Module.splashScreenStyle;
12 | gameInstance.progress.empty = document.createElement("div");
13 | gameInstance.progress.empty.className = "empty";
14 | gameInstance.progress.appendChild(gameInstance.progress.empty);
15 | gameInstance.progress.full = document.createElement("div");
16 | gameInstance.progress.full.className = "full";
17 | gameInstance.progress.appendChild(gameInstance.progress.full);
18 | gameInstance.container.appendChild(gameInstance.progress);
19 | }
20 | gameInstance.progress.full.style.width = (100 * progress) + "%";
21 | gameInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
22 | if (progress == 1)
23 | gameInstance.logo.style.display = gameInstance.progress.style.display = "none";
24 | }
--------------------------------------------------------------------------------
/MaskShader/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/MaskShader/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/MaskShader/TemplateData/progressEmpty.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/progressEmpty.Dark.png
--------------------------------------------------------------------------------
/MaskShader/TemplateData/progressEmpty.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/progressEmpty.Light.png
--------------------------------------------------------------------------------
/MaskShader/TemplateData/progressFull.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/progressFull.Dark.png
--------------------------------------------------------------------------------
/MaskShader/TemplateData/progressFull.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/progressFull.Light.png
--------------------------------------------------------------------------------
/MaskShader/TemplateData/progressLogo.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/progressLogo.Dark.png
--------------------------------------------------------------------------------
/MaskShader/TemplateData/progressLogo.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/progressLogo.Light.png
--------------------------------------------------------------------------------
/MaskShader/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | .webgl-content * {border: 0; margin: 0; padding: 0}
2 | .webgl-content {position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
3 |
4 | .webgl-content .logo, .progress {position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
5 | .webgl-content .logo {background: url('progressLogo.Light.png') no-repeat center / contain; width: 154px; height: 130px;}
6 | .webgl-content .progress {height: 18px; width: 141px; margin-top: 90px;}
7 | .webgl-content .progress .empty {background: url('progressEmpty.Light.png') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;}
8 | .webgl-content .progress .full {background: url('progressFull.Light.png') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;}
9 |
10 | .webgl-content .logo.Dark {background-image: url('progressLogo.Dark.png');}
11 | .webgl-content .progress.Dark .empty {background-image: url('progressEmpty.Dark.png');}
12 | .webgl-content .progress.Dark .full {background-image: url('progressFull.Dark.png');}
13 |
14 | .webgl-content .footer {margin-top: 5px; height: 38px; line-height: 38px; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 18px;}
15 | .webgl-content .footer .webgl-logo, .title, .fullscreen {height: 100%; display: inline-block; background: transparent center no-repeat;}
16 | .webgl-content .footer .webgl-logo {background-image: url('webgl-logo.png'); width: 204px; float: left;}
17 | .webgl-content .footer .title {margin-right: 10px; float: right;}
18 | .webgl-content .footer .fullscreen {background-image: url('fullscreen.png'); width: 38px; float: right;}
--------------------------------------------------------------------------------
/MaskShader/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/MaskShader/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/MaskShader/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | MaskShader
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Particles/Build/Particles.asm.code.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/Build/Particles.asm.code.unityweb
--------------------------------------------------------------------------------
/Particles/Build/Particles.asm.framework.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/Build/Particles.asm.framework.unityweb
--------------------------------------------------------------------------------
/Particles/Build/Particles.asm.memory.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/Build/Particles.asm.memory.unityweb
--------------------------------------------------------------------------------
/Particles/Build/Particles.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/Build/Particles.data.unityweb
--------------------------------------------------------------------------------
/Particles/Build/Particles.json:
--------------------------------------------------------------------------------
1 | {
2 | "TOTAL_MEMORY": 268435456,
3 | "dataUrl": "Particles.data.unityweb",
4 | "asmCodeUrl": "Particles.asm.code.unityweb",
5 | "asmMemoryUrl": "Particles.asm.memory.unityweb",
6 | "asmFrameworkUrl": "Particles.asm.framework.unityweb",
7 | "splashScreenStyle": "Dark",
8 | "backgroundColor": "#222C36"
9 | }
--------------------------------------------------------------------------------
/Particles/Particles.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class Fragment
6 | {
7 | public Vector3 home;
8 | public Color col;
9 | }
10 |
11 | public class Particles : MonoBehaviour
12 | {
13 | public Texture2D inputTex;
14 | ParticleSystem ps;
15 | List fragments;
16 | ParticleSystem.Particle[] particles;
17 | float radius = 3;
18 | void Start ()
19 | {
20 | ps = GetComponent();
21 | CreateParticles();
22 | }
23 |
24 | void CreateParticles()
25 | {
26 | fragments = new List();
27 |
28 | var cols = inputTex.GetPixels();
29 | var width = inputTex.width;
30 | var height = inputTex.height;
31 | var offset = new Vector3(-width,-height) * 0.5f;
32 | for(int x = 0; x < width; x+=2)
33 | {
34 | for(int y = 0; y < height; y+=2)
35 | {
36 | var col = cols[x + y * width];
37 | if (col.a >0)
38 | {
39 | var f = new Fragment();
40 | f.home = (offset + new Vector3(x, y, 0))*0.05f;
41 | f.col = col;
42 | fragments.Add(f);
43 | }
44 | }
45 | }
46 | particles = new ParticleSystem.Particle[fragments.Count];
47 | for(int i = 0; i < fragments.Count; i++)
48 | {
49 | var p = new ParticleSystem.Particle();
50 | p.position = fragments[i].home;
51 | p.color = fragments[i].col;
52 | p.color = new Color32(p.color.r, p.color.g, p.color.b, 255);
53 | p.lifetime = float.PositiveInfinity;
54 | p.size = 0.4f;
55 | p.startLifetime = float.PositiveInfinity;
56 | particles[i] = p;
57 | }
58 | ps.SetParticles(particles, particles.Length);
59 | Debug.Log("Count: " + fragments.Count);
60 | }
61 |
62 |
63 | void Update ()
64 | {
65 | ps.GetParticles(particles);
66 | var plane = new Plane(-transform.forward,transform.position);
67 | var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
68 | float dist = 0;
69 | plane.Raycast(ray, out dist);
70 | var pos = ray.GetPoint(dist);
71 |
72 | float v = Input.GetAxis("Mouse ScrollWheel");
73 | if (v != 0)
74 | radius = Mathf.Clamp(radius + v * 1f, 1f, 300);
75 |
76 |
77 | int count = particles.Length;
78 | for(int i = 0; i < count; i++)
79 | {
80 | var p = particles[i];
81 | var f = fragments[i];
82 | p.velocity *= 0.9f;
83 | p.velocity += (f.home - p.position);
84 |
85 | // apply random position offset and velocity to each particle
86 | if (Input.GetKey(KeyCode.A))
87 | {
88 | p.velocity += new Vector3(Random.Range(-10, 10), Random.Range(-10, 10));
89 | p.position += new Vector3(Random.Range(-10, 10), Random.Range(-10, 10));
90 | }
91 | // apply offset and repelling velocity according to the mouse position.
92 | if (Input.GetMouseButton(0) || v!=0)
93 | {
94 | var d = p.position - pos;
95 | if (d.sqrMagnitude < radius * radius) // if particle is inside our circle
96 | {
97 | d = d.normalized;
98 | p.position = pos + d * radius; // offset the particle to the border of the circle
99 | p.velocity += d; // additionally add a repelling force
100 | }
101 | }
102 | particles[i] = p;
103 | }
104 | ps.SetParticles(particles, count);
105 | }
106 | void OnGUI()
107 | {
108 | GUILayout.Label("Particle Count: " + particles.Length + "\nRadius: " + radius.ToString("f2"));
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/Particles/ParticlesDemo.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/ParticlesDemo.unitypackage
--------------------------------------------------------------------------------
/Particles/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress(gameInstance, progress) {
2 | if (!gameInstance.Module)
3 | return;
4 | if (!gameInstance.logo) {
5 | gameInstance.logo = document.createElement("div");
6 | gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle;
7 | gameInstance.container.appendChild(gameInstance.logo);
8 | }
9 | if (!gameInstance.progress) {
10 | gameInstance.progress = document.createElement("div");
11 | gameInstance.progress.className = "progress " + gameInstance.Module.splashScreenStyle;
12 | gameInstance.progress.empty = document.createElement("div");
13 | gameInstance.progress.empty.className = "empty";
14 | gameInstance.progress.appendChild(gameInstance.progress.empty);
15 | gameInstance.progress.full = document.createElement("div");
16 | gameInstance.progress.full.className = "full";
17 | gameInstance.progress.appendChild(gameInstance.progress.full);
18 | gameInstance.container.appendChild(gameInstance.progress);
19 | }
20 | gameInstance.progress.full.style.width = (100 * progress) + "%";
21 | gameInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
22 | if (progress == 1)
23 | gameInstance.logo.style.display = gameInstance.progress.style.display = "none";
24 | }
--------------------------------------------------------------------------------
/Particles/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/Particles/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/Particles/TemplateData/progressEmpty.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/progressEmpty.Dark.png
--------------------------------------------------------------------------------
/Particles/TemplateData/progressEmpty.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/progressEmpty.Light.png
--------------------------------------------------------------------------------
/Particles/TemplateData/progressFull.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/progressFull.Dark.png
--------------------------------------------------------------------------------
/Particles/TemplateData/progressFull.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/progressFull.Light.png
--------------------------------------------------------------------------------
/Particles/TemplateData/progressLogo.Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/progressLogo.Dark.png
--------------------------------------------------------------------------------
/Particles/TemplateData/progressLogo.Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/progressLogo.Light.png
--------------------------------------------------------------------------------
/Particles/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | .webgl-content * {border: 0; margin: 0; padding: 0}
2 | .webgl-content {position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
3 |
4 | .webgl-content .logo, .progress {position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
5 | .webgl-content .logo {background: url('progressLogo.Light.png') no-repeat center / contain; width: 154px; height: 130px;}
6 | .webgl-content .progress {height: 18px; width: 141px; margin-top: 90px;}
7 | .webgl-content .progress .empty {background: url('progressEmpty.Light.png') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;}
8 | .webgl-content .progress .full {background: url('progressFull.Light.png') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;}
9 |
10 | .webgl-content .logo.Dark {background-image: url('progressLogo.Dark.png');}
11 | .webgl-content .progress.Dark .empty {background-image: url('progressEmpty.Dark.png');}
12 | .webgl-content .progress.Dark .full {background-image: url('progressFull.Dark.png');}
13 |
14 | .webgl-content .footer {margin-top: 5px; height: 38px; line-height: 38px; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 18px;}
15 | .webgl-content .footer .webgl-logo, .title, .fullscreen {height: 100%; display: inline-block; background: transparent center no-repeat;}
16 | .webgl-content .footer .webgl-logo {background-image: url('webgl-logo.png'); width: 204px; float: left;}
17 | .webgl-content .footer .title {margin-right: 10px; float: right;}
18 | .webgl-content .footer .fullscreen {background-image: url('fullscreen.png'); width: 38px; float: right;}
--------------------------------------------------------------------------------
/Particles/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Particles/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/Particles/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | Particles
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UnityWebExamples
2 |
3 | - [DataURLTest](https://bunny83.github.io/UnityWebExamples/DataURLTest/)
4 | - [ImageShapeDetection](https://bunny83.github.io/UnityWebExamples/ImageShapeDetection/)
5 | - [Mandelbrot](https://bunny83.github.io/UnityWebExamples/Mandelbrot/)
6 | - [MaskShader](https://bunny83.github.io/UnityWebExamples/MaskShader/)
7 | - [Particles](https://bunny83.github.io/UnityWebExamples/Particles/)
8 | - [Teapot](https://bunny83.github.io/UnityWebExamples/Teapot/)
9 | - [VisPortals](https://bunny83.github.io/UnityWebExamples/VisPortals/)
10 | - [ExpressionParser](https://bunny83.github.io/UnityWebExamples/ExpressionParserWebGL/)
11 | - [HowUnityWorks(FixedUpdate)](https://bunny83.github.io/UnityWebExamples/HowUnityWorks/?level=FixedUpdate)
12 | - [Towers of Hanoi](https://bunny83.github.io/UnityWebExamples/Hanoi/)
13 | - [Intercept Example](https://bunny83.github.io/UnityWebExamples/InterceptExample/)
14 | - [Infinite "Zoom" Example](https://bunny83.github.io/UnityWebExamples/InfiniteZoomExample/)
15 | - [HealthBar Example](https://bunny83.github.io/UnityWebExamples/HealthBarExample/index.html)
16 | - [Solar System Diagram](https://bunny83.github.io/UnityWebExamples/SolarSystemDiagram/index.html)
17 | - [Cube Sphere Terrain](https://bunny83.github.io/UnityWebExamples/CubeSphere/index.html)
18 | - [UV Mapping](https://bunny83.github.io/UnityWebExamples/UVMapping/index.html)
19 | - [Texture Drawing](https://bunny83.github.io/UnityWebExamples/TextureDrawing/index.html)
20 | - [GraphCalc](https://bunny83.github.io/UnityWebExamples/GraphCalc/index.html)
21 | - [SpaceTest](https://bunny83.github.io/UnityWebExamples/SpaceTest/index.html)
22 |
23 |
--------------------------------------------------------------------------------
/SolarSystemDiagram/Build/SolarSystemDiagram.data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/Build/SolarSystemDiagram.data
--------------------------------------------------------------------------------
/SolarSystemDiagram/Build/SolarSystemDiagram.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/Build/SolarSystemDiagram.wasm
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/fullscreen-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/fullscreen-button.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/progress-bar-empty-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/progress-bar-empty-dark.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/progress-bar-empty-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/progress-bar-empty-light.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/progress-bar-full-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/progress-bar-full-dark.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/progress-bar-full-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/progress-bar-full-light.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0 }
2 | #unity-container { position: absolute }
3 | #unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4 | #unity-container.unity-mobile { width: 100%; height: 100% }
5 | #unity-canvas { background: #231F20 }
6 | .unity-mobile #unity-canvas { width: 100%; height: 100% }
7 | #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8 | #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9 | #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 }
10 | #unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11 | #unity-footer { position: relative }
12 | .unity-mobile #unity-footer { display: none }
13 | #unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14 | #unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15 | #unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16 | #unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
17 |
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/unity-logo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/unity-logo-dark.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/unity-logo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/unity-logo-light.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SolarSystemDiagram/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/SolarSystemDiagram/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | SolarSystem
7 |
8 |
9 |
10 |
11 |
26 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/SpaceTest/Build/SpaceTest.data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/Build/SpaceTest.data
--------------------------------------------------------------------------------
/SpaceTest/Build/SpaceTest.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/Build/SpaceTest.wasm
--------------------------------------------------------------------------------
/SpaceTest/StreamingAssets/UnityServicesProjectConfiguration.json:
--------------------------------------------------------------------------------
1 | {"Keys":["com.unity.services.core.cloud-environment","com.unity.services.core.version","com.unity.services.core.initializer-assembly-qualified-names","com.unity.services.core.all-package-names"],"Values":[{"m_Value":"production","m_IsReadOnly":false},{"m_Value":"1.6.0","m_IsReadOnly":true},{"m_Value":"Unity.Services.Core.Registration.CorePackageInitializer, Unity.Services.Core.Registration, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null","m_IsReadOnly":true},{"m_Value":"com.unity.services.core","m_IsReadOnly":false}]}
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/fullscreen-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/fullscreen-button.png
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/progress-bar-empty-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/progress-bar-empty-dark.png
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/progress-bar-empty-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/progress-bar-empty-light.png
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/progress-bar-full-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/progress-bar-full-dark.png
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/progress-bar-full-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/progress-bar-full-light.png
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0 }
2 | #unity-container { position: absolute }
3 | #unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4 | #unity-container.unity-mobile { width: 100%; height: 100% }
5 | #unity-canvas { background: #231F20 }
6 | .unity-mobile #unity-canvas { width: 100%; height: 100% }
7 | #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8 | #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9 | #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 }
10 | #unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11 | #unity-footer { position: relative }
12 | .unity-mobile #unity-footer { display: none }
13 | #unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14 | #unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15 | #unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16 | #unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
17 |
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/unity-logo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/unity-logo-dark.png
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/unity-logo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/unity-logo-light.png
--------------------------------------------------------------------------------
/SpaceTest/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/SpaceTest/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/SpaceTest/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | SpaceTest
7 |
8 |
9 |
10 |
11 |
26 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/Teapot/Release/Teapot.datagz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/Release/Teapot.datagz
--------------------------------------------------------------------------------
/Teapot/Release/Teapot.jsgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/Release/Teapot.jsgz
--------------------------------------------------------------------------------
/Teapot/Release/Teapot.memgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/Release/Teapot.memgz
--------------------------------------------------------------------------------
/Teapot/TeapotTest.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/TeapotTest.zip
--------------------------------------------------------------------------------
/Teapot/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress (dom) {
2 | this.progress = 0.0;
3 | this.message = "";
4 | this.dom = dom;
5 |
6 | var parent = dom.parentNode;
7 |
8 | var background = document.createElement("div");
9 | background.style.background = "#4D4D4D";
10 | background.style.position = "absolute";
11 | parent.appendChild(background);
12 | this.background = background;
13 |
14 | var logoImage = document.createElement("img");
15 | logoImage.src = "TemplateData/progresslogo.png";
16 | logoImage.style.position = "absolute";
17 | parent.appendChild(logoImage);
18 | this.logoImage = logoImage;
19 |
20 | var progressFrame = document.createElement("img");
21 | progressFrame.src = "TemplateData/loadingbar.png";
22 | progressFrame.style.position = "absolute";
23 | parent.appendChild(progressFrame);
24 | this.progressFrame = progressFrame;
25 |
26 | var progressBar = document.createElement("img");
27 | progressBar.src = "TemplateData/fullbar.png";
28 | progressBar.style.position = "absolute";
29 | parent.appendChild(progressBar);
30 | this.progressBar = progressBar;
31 |
32 | var messageArea = document.createElement("p");
33 | messageArea.style.position = "absolute";
34 | parent.appendChild(messageArea);
35 | this.messageArea = messageArea;
36 |
37 |
38 | this.SetProgress = function (progress) {
39 | if (this.progress < progress)
40 | this.progress = progress;
41 | this.messageArea.style.display = "none";
42 | this.progressFrame.style.display = "inline";
43 | this.progressBar.style.display = "inline";
44 | this.Update();
45 | }
46 |
47 | this.SetMessage = function (message) {
48 | this.message = message;
49 | this.background.style.display = "inline";
50 | this.logoImage.style.display = "inline";
51 | this.progressFrame.style.display = "none";
52 | this.progressBar.style.display = "none";
53 | this.Update();
54 | }
55 |
56 | this.Clear = function() {
57 | this.background.style.display = "none";
58 | this.logoImage.style.display = "none";
59 | this.progressFrame.style.display = "none";
60 | this.progressBar.style.display = "none";
61 | }
62 |
63 | this.Update = function() {
64 | this.background.style.top = this.dom.offsetTop + 'px';
65 | this.background.style.left = this.dom.offsetLeft + 'px';
66 | this.background.style.width = this.dom.offsetWidth + 'px';
67 | this.background.style.height = this.dom.offsetHeight + 'px';
68 |
69 | var logoImg = new Image();
70 | logoImg.src = this.logoImage.src;
71 | var progressFrameImg = new Image();
72 | progressFrameImg.src = this.progressFrame.src;
73 |
74 | this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px';
75 | this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px';
76 | this.logoImage.style.width = logoImg.width+'px';
77 | this.logoImage.style.height = logoImg.height+'px';
78 |
79 | this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px';
80 | this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px';
81 | this.progressFrame.width = progressFrameImg.width;
82 | this.progressFrame.height = progressFrameImg.height;
83 |
84 | this.progressBar.style.top = this.progressFrame.style.top;
85 | this.progressBar.style.left = this.progressFrame.style.left;
86 | this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1);
87 | this.progressBar.height = progressFrameImg.height;
88 |
89 | this.messageArea.style.top = this.progressFrame.style.top;
90 | this.messageArea.style.left = 0;
91 | this.messageArea.style.width = '100%';
92 | this.messageArea.style.textAlign = 'center';
93 | this.messageArea.innerHTML = this.message;
94 | }
95 |
96 | this.Update ();
97 | }
--------------------------------------------------------------------------------
/Teapot/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/Teapot/TemplateData/fullbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/TemplateData/fullbar.png
--------------------------------------------------------------------------------
/Teapot/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/Teapot/TemplateData/loadingbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/TemplateData/loadingbar.png
--------------------------------------------------------------------------------
/Teapot/TemplateData/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/TemplateData/logo.png
--------------------------------------------------------------------------------
/Teapot/TemplateData/progresslogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/Teapot/TemplateData/progresslogo.png
--------------------------------------------------------------------------------
/Teapot/TemplateData/style.css:
--------------------------------------------------------------------------------
1 |
2 | /****************************************
3 | ==== RESETS
4 | ****************************************/
5 |
6 | html,body,div,canvas { margin: 0; padding: 0; }
7 | ::-moz-selection { color: #333; text-shadow: none; }
8 | ::selection { color: #333; text-shadow: none; }
9 | .clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
10 | .clear { display: inline-table; clear: both; }
11 | /* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */
12 |
13 | /****************************************
14 | ==== LAYOUT
15 | ****************************************/
16 |
17 | html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }
18 | body { }
19 | p.header, p.footer { display: none; }
20 | div.logo { width: 204px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; }
21 | div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; }
22 | .template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }
23 | .template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
24 | .fullscreen { float: right; position: relative; z-index: 10; }
25 |
26 | body.template { }
27 | .template .template-wrap { }
28 | .template .template-wrap canvas { }
29 |
--------------------------------------------------------------------------------
/Teapot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | TeapotTest
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
TeapotTest
19 |
20 |
21 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Test/ImageTest.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/TextureDrawing/Build/WebGLBuild.data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/Build/WebGLBuild.data
--------------------------------------------------------------------------------
/TextureDrawing/Build/WebGLBuild.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/Build/WebGLBuild.wasm
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/MemoryProfiler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/MemoryProfiler.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/fullscreen-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/fullscreen-button.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/progress-bar-empty-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/progress-bar-empty-dark.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/progress-bar-empty-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/progress-bar-empty-light.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/progress-bar-full-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/progress-bar-full-dark.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/progress-bar-full-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/progress-bar-full-light.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0 }
2 | #unity-container { position: absolute }
3 | #unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4 | #unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
5 | #unity-canvas { background: #231F20 }
6 | .unity-mobile #unity-canvas { width: 100%; height: 100% }
7 | #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8 | #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9 | #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 }
10 | #unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11 | #unity-footer { position: relative }
12 | .unity-mobile #unity-footer { display: none }
13 | #unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14 | #unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15 | #unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16 | #unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
17 |
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/unity-logo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/unity-logo-dark.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/unity-logo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/unity-logo-light.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/TextureDrawing/TemplateData/webmemd-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/TextureDrawing/TemplateData/webmemd-icon.png
--------------------------------------------------------------------------------
/TextureDrawing/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | DrawingExample
7 |
8 |
9 |
10 |
11 |
26 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/UVMapping/Build/UVMapping.data.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/Build/UVMapping.data.unityweb
--------------------------------------------------------------------------------
/UVMapping/Build/UVMapping.framework.js.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/Build/UVMapping.framework.js.unityweb
--------------------------------------------------------------------------------
/UVMapping/Build/UVMapping.wasm.unityweb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/Build/UVMapping.wasm.unityweb
--------------------------------------------------------------------------------
/UVMapping/TemplateData/MemoryProfiler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/MemoryProfiler.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/UVMapping/TemplateData/fullscreen-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/fullscreen-button.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/progress-bar-empty-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/progress-bar-empty-dark.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/progress-bar-empty-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/progress-bar-empty-light.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/progress-bar-full-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/progress-bar-full-dark.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/progress-bar-full-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/progress-bar-full-light.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/style.css:
--------------------------------------------------------------------------------
1 | body { padding: 0; margin: 0 }
2 | #unity-container { position: absolute }
3 | #unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
4 | #unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
5 | #unity-canvas { background: #231F20 }
6 | .unity-mobile #unity-canvas { width: 100%; height: 100% }
7 | #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
8 | #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
9 | #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 }
10 | #unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
11 | #unity-footer { position: relative }
12 | .unity-mobile #unity-footer { display: none }
13 | #unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
14 | #unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
15 | #unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
16 | #unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
17 |
--------------------------------------------------------------------------------
/UVMapping/TemplateData/unity-logo-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/unity-logo-dark.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/unity-logo-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/unity-logo-light.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/webgl-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/webgl-logo.png
--------------------------------------------------------------------------------
/UVMapping/TemplateData/webmemd-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UVMapping/TemplateData/webmemd-icon.png
--------------------------------------------------------------------------------
/UVMapping/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | UVMapping
7 |
8 |
9 |
10 |
11 |
26 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/UnityAnswers/VoronoiImages/readme.md:
--------------------------------------------------------------------------------
1 | # Some generated Voronoi image examples
2 |
3 | - [2048 x 1024 @50 took 5643ms](w2048_h1024_s50_t5643ms.png)
4 | - [2048 x 1024 @10000 took 11327ms](w2048_h1024_s10000_t11327ms.png)
5 | - [4096 x 4096 @10000 took 75601ms](w4096_h4096_s10000_t75601ms.png)
6 | - [4096 x 4096 @100000 took 88932ms](w4096_h4096_s100000_t88932ms.png)
7 |
--------------------------------------------------------------------------------
/UnityAnswers/VoronoiImages/w2048_h1024_s10000_t11327ms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UnityAnswers/VoronoiImages/w2048_h1024_s10000_t11327ms.png
--------------------------------------------------------------------------------
/UnityAnswers/VoronoiImages/w2048_h1024_s50_t5643ms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UnityAnswers/VoronoiImages/w2048_h1024_s50_t5643ms.png
--------------------------------------------------------------------------------
/UnityAnswers/VoronoiImages/w4096_h4096_s100000_t88932ms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UnityAnswers/VoronoiImages/w4096_h4096_s100000_t88932ms.png
--------------------------------------------------------------------------------
/UnityAnswers/VoronoiImages/w4096_h4096_s10000_t75601ms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/UnityAnswers/VoronoiImages/w4096_h4096_s10000_t75601ms.png
--------------------------------------------------------------------------------
/VisPortals/Release/VisPortalExample.datagz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/Release/VisPortalExample.datagz
--------------------------------------------------------------------------------
/VisPortals/Release/VisPortalExample.jsgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/Release/VisPortalExample.jsgz
--------------------------------------------------------------------------------
/VisPortals/Release/VisPortalExample.memgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/Release/VisPortalExample.memgz
--------------------------------------------------------------------------------
/VisPortals/TemplateData/UnityProgress.js:
--------------------------------------------------------------------------------
1 | function UnityProgress (dom) {
2 | this.progress = 0.0;
3 | this.message = "";
4 | this.dom = dom;
5 |
6 | var parent = dom.parentNode;
7 |
8 | var background = document.createElement("div");
9 | background.style.background = "#4D4D4D";
10 | background.style.position = "absolute";
11 | parent.appendChild(background);
12 | this.background = background;
13 |
14 | var logoImage = document.createElement("img");
15 | logoImage.src = "TemplateData/progresslogo.png";
16 | logoImage.style.position = "absolute";
17 | parent.appendChild(logoImage);
18 | this.logoImage = logoImage;
19 |
20 | var progressFrame = document.createElement("img");
21 | progressFrame.src = "TemplateData/loadingbar.png";
22 | progressFrame.style.position = "absolute";
23 | parent.appendChild(progressFrame);
24 | this.progressFrame = progressFrame;
25 |
26 | var progressBar = document.createElement("img");
27 | progressBar.src = "TemplateData/fullbar.png";
28 | progressBar.style.position = "absolute";
29 | parent.appendChild(progressBar);
30 | this.progressBar = progressBar;
31 |
32 | var messageArea = document.createElement("p");
33 | messageArea.style.position = "absolute";
34 | parent.appendChild(messageArea);
35 | this.messageArea = messageArea;
36 |
37 |
38 | this.SetProgress = function (progress) {
39 | if (this.progress < progress)
40 | this.progress = progress;
41 | this.messageArea.style.display = "none";
42 | this.progressFrame.style.display = "inline";
43 | this.progressBar.style.display = "inline";
44 | this.Update();
45 | }
46 |
47 | this.SetMessage = function (message) {
48 | this.message = message;
49 | this.background.style.display = "inline";
50 | this.logoImage.style.display = "inline";
51 | this.progressFrame.style.display = "none";
52 | this.progressBar.style.display = "none";
53 | this.Update();
54 | }
55 |
56 | this.Clear = function() {
57 | this.background.style.display = "none";
58 | this.logoImage.style.display = "none";
59 | this.progressFrame.style.display = "none";
60 | this.progressBar.style.display = "none";
61 | }
62 |
63 | this.Update = function() {
64 | this.background.style.top = this.dom.offsetTop + 'px';
65 | this.background.style.left = this.dom.offsetLeft + 'px';
66 | this.background.style.width = this.dom.offsetWidth + 'px';
67 | this.background.style.height = this.dom.offsetHeight + 'px';
68 |
69 | var logoImg = new Image();
70 | logoImg.src = this.logoImage.src;
71 | var progressFrameImg = new Image();
72 | progressFrameImg.src = this.progressFrame.src;
73 |
74 | this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px';
75 | this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px';
76 | this.logoImage.style.width = logoImg.width+'px';
77 | this.logoImage.style.height = logoImg.height+'px';
78 |
79 | this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px';
80 | this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px';
81 | this.progressFrame.width = progressFrameImg.width;
82 | this.progressFrame.height = progressFrameImg.height;
83 |
84 | this.progressBar.style.top = this.progressFrame.style.top;
85 | this.progressBar.style.left = this.progressFrame.style.left;
86 | this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1);
87 | this.progressBar.height = progressFrameImg.height;
88 |
89 | this.messageArea.style.top = this.progressFrame.style.top;
90 | this.messageArea.style.left = 0;
91 | this.messageArea.style.width = '100%';
92 | this.messageArea.style.textAlign = 'center';
93 | this.messageArea.innerHTML = this.message;
94 | }
95 |
96 | this.Update ();
97 | }
--------------------------------------------------------------------------------
/VisPortals/TemplateData/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/TemplateData/favicon.ico
--------------------------------------------------------------------------------
/VisPortals/TemplateData/fullbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/TemplateData/fullbar.png
--------------------------------------------------------------------------------
/VisPortals/TemplateData/fullscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/TemplateData/fullscreen.png
--------------------------------------------------------------------------------
/VisPortals/TemplateData/loadingbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/TemplateData/loadingbar.png
--------------------------------------------------------------------------------
/VisPortals/TemplateData/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/TemplateData/logo.png
--------------------------------------------------------------------------------
/VisPortals/TemplateData/progresslogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/TemplateData/progresslogo.png
--------------------------------------------------------------------------------
/VisPortals/TemplateData/style.css:
--------------------------------------------------------------------------------
1 |
2 | /****************************************
3 | ==== RESETS
4 | ****************************************/
5 |
6 | html,body,div,canvas { margin: 0; padding: 0; }
7 | ::-moz-selection { color: #333; text-shadow: none; }
8 | ::selection { color: #333; text-shadow: none; }
9 | .clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
10 | .clear { display: inline-table; clear: both; }
11 | /* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */
12 |
13 | /****************************************
14 | ==== LAYOUT
15 | ****************************************/
16 |
17 | html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }
18 | body { }
19 | p.header, p.footer { display: none; }
20 | div.logo { width: 204px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; }
21 | div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; }
22 | .template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }
23 | .template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
24 | .fullscreen { float: right; position: relative; z-index: 10; }
25 |
26 | body.template { }
27 | .template .template-wrap { }
28 | .template .template-wrap canvas { }
29 |
--------------------------------------------------------------------------------
/VisPortals/VisPortals.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bunny83/UnityWebExamples/9b7de7652d524cfd776b8980f1536433c7338f6c/VisPortals/VisPortals.zip
--------------------------------------------------------------------------------
/VisPortals/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unity WebGL Player | VisPortals
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Download project here: VisPortals.zip
18 |
19 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------