File tree 4 files changed +33
-57
lines changed
4 files changed +33
-57
lines changed Original file line number Diff line number Diff line change 1
- # Unity Vue Boilerplate
1
+ # UnityWebGL VueJS Boilerplate
2
2
3
3
This is a boilerplate ** Unity WebGL** ++ ** VueJS** web app with ** VueX && ** vue-router** pre-installed.
4
4
5
5
This project takes advantage of the Unity3d web container wrapper component provided by
6
6
@votetake 's [ vue-unity-webgl] ( https://github.com/votetake/vue-unity-webgl ) Node package.
7
7
8
+ ## Directory Structure
8
9
10
+ ` ./public/Build ` && ` ./public/TemplateData ` - the templates/JS functions of a bare Unity3D WebGL project.
11
+
12
+ ## Send a string from VueJS to the Unity Scene
13
+
14
+ The Unity scene contains only a lean 3D plane and a text object.
15
+
16
+ Text can be sent to the text object in the Unity game instance via the ` @click ` method in ` ./src/views/Home.vue ` :
17
+
18
+ ``` JavaScript
19
+ // $refs.myInstance === <unity ref="myInstance">
20
+ this .$refs .myInstance .message (' Text' , ' SetText' , this .textInput )
21
+ ```
9
22
10
23
## Project setup
11
24
```
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " unity-vue-boilerplate" ,
2
+ "name" : " unity-vuejs-boilerplate" ,
3
+ "author" :
" Nick West <[email protected] >" ,
3
4
"version" : " 0.1.0" ,
4
5
"private" : true ,
5
6
"scripts" : {
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" " >
3
- <unity src =" /Build/WebGL-Test.json" width =" 1000" height =" 600" unityLoader =" /Build/UnityLoader.js" ref =" myInstance" ></unity >
4
- <input type =" text" v-model =" textInput" description =" Input text here to send to Unity" >
3
+ <!--
4
+ The Unity Container.
5
+ Look in the src of npm-modules/vue-unity/webgl/ after npm installing for the mechanics of this custom component
6
+ -->
7
+ <unity
8
+ src =" /Build/WebGL-Test.json"
9
+ width =" 1000"
10
+ height =" 600"
11
+ unityLoader =" /Build/UnityLoader.js" ref =" myInstance"
12
+ >
13
+ </unity >
5
14
6
- <button @click =" inputText" >My Button >:(</button >
15
+ <!-- Unstyled text input + button -->
16
+ <input type =" text" v-model =" textInput" description =" Input text here to send to Unity" >
17
+ <button @click =" inputText" >
18
+ Send a string to Unity
19
+ </button >
7
20
</div >
8
-
9
21
</template >
10
22
<script >
11
23
import Unity from ' vue-unity-webgl'
@@ -21,7 +33,7 @@ export default {
21
33
}
22
34
},
23
35
methods: {
24
- sendText () {
36
+ sendText () {
25
37
this .$refs .myInstance .message (' Text' , ' SetText' , this .textInput )
26
38
}
27
39
}
You can’t perform that action at this time.
0 commit comments