unity-webgl
Advanced tools
Comparing version
@@ -11,3 +11,7 @@ { | ||
], | ||
"version": "1.0.0", | ||
"version": "1.1.2", | ||
"main": "dist/UnityWebgl.umd.js", | ||
"module": "dist/UnityWebgl.esm.js", | ||
"unpkg": "dist/UnityWebgl.min.js", | ||
"jsdelivr": "dist/UnityWebgl.min.js", | ||
"homepage": "https://github.com/Meqn/UnityWebGL.js", | ||
@@ -64,6 +68,7 @@ "repository": { | ||
"sass-loader": "^8.0.2", | ||
"unity-webgl": "^1.0.0", | ||
"vue": "^2.6.14", | ||
"vue-template-compiler": "^2.6.11", | ||
"vuepress": "^1.8.2", | ||
"vue": "^2.6.14" | ||
"vuepress": "^1.8.2" | ||
} | ||
} |
# unity-webgl | ||
Unity WebGL provides an easy solution for embedding Unity WebGL builds in your webApp, with two-way communication between your webApp and Unity application with advanced API's. | ||
Unity WebGL provides an easy solution for embedding Unity WebGL builds in your webApp or Vue.js project, with two-way communication between your webApp and Unity application with advanced API's. | ||
base on [react-unity-webgl](https://github.com/jeffreylanters/react-unity-webgl) | ||
based on [react-unity-webgl](https://github.com/jeffreylanters/react-unity-webgl) | ||
## features | ||
- Simple 、 flexible | ||
- two-way communication (webApp, Unity) | ||
- Built-in event handler | ||
- Available for Vue.js | ||
## Install | ||
@@ -13,4 +19,8 @@ ``` | ||
## Usage | ||
in example.html: | ||
```html | ||
<canvas id="canvas" style="width: 100%; height: 100%"></canvas> | ||
<button onclick="onDestroy()">Destroy</button> | ||
@@ -76,2 +86,40 @@ <button onclick="onLoad()">Reload</button> | ||
### Vue | ||
in example.vue | ||
```html | ||
<template> | ||
<Unity :unity="unityContext" width="800px" heighht="600px" /> | ||
</template> | ||
<script> | ||
import UnityWebgl, { VueUnity } from 'unity-webgl' | ||
const Unity = new UnityWebgl({ | ||
loaderUrl: 'Build/OUT_BIM.loader.js', | ||
dataUrl: "Build/OUT_BIM.data", | ||
frameworkUrl: "Build/OUT_BIM.framework.js", | ||
codeUrl: "Build/OUT_BIM.wasm", | ||
streamingAssetsUrl: "StreamingAssets", | ||
companyName: "DefaultCompany", | ||
productName: "BIM", | ||
productVersion: "0.1", | ||
}) | ||
export default { | ||
name: 'Unity', | ||
component: { | ||
Unity: VueUnity | ||
}, | ||
data() { | ||
return { | ||
unityContext: Unity | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
## methods | ||
@@ -78,0 +126,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38029
180.24%9
12.5%821
296.62%140
52.17%33
3.13%1
Infinity%