File tree 2 files changed +29
-19
lines changed
2 files changed +29
-19
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ Spin up Node dev server:
17
17
npm run serve
18
18
```
19
19
20
-
21
20
## Directory Structure
22
21
23
22
` ./public/Build ` && ` ./public/TemplateData ` - the templates/JS functions of a bare Unity3D WebGL project.
@@ -33,7 +32,14 @@ Text can be sent to the text object in the Unity game instance via the `@click`
33
32
this .$refs .myInstance .message (' Text' , ' SetText' , this .textInput )
34
33
```
35
34
35
+ Note: Further configuration is needed to make the text input in ` ./src/views/Home.vue ` editable after the Unity game loads,
36
+ since the Unity WebGL instance grabs all keyboard input to the page. There is an example string in the input box for this reason.
37
+
38
+ [ Related Unity forum thread] ( https://forum.unity.com/threads/disable-enable-keyboard-in-runtime-webgl.286557/#post-1892527 )
39
+
40
+ ## Trigger a webpage JavaScript function from Unity Scene
36
41
42
+ [ WIP]
37
43
38
44
## Project setup
39
45
```
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" " >
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 >
14
-
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 >
3
+ <div class =" " >
4
+ <!--
5
+ The Unity Container.
6
+ Look in the src of npm-modules/vue-unity/webgl/ after npm installing for the mechanics of this custom component
7
+ -->
8
+ <unity
9
+ src =" /Build/WebGL-Test.json"
10
+ width =" 1000"
11
+ height =" 600"
12
+ unityLoader =" /Build/UnityLoader.js" ref =" myInstance"
13
+ >
14
+ </unity >
15
+ </div >
16
+ <div class =" " >
17
+ <!-- Unstyled text input + button -->
18
+ <input v-model =" textInput" placeholder =" Enter a string to send to Unity" >
19
+ <button @click =" sendText" >
20
+ Send a string to Unity
21
+ </button >
22
+ </div >
20
23
</div >
21
24
</template >
22
25
<script >
@@ -29,11 +32,12 @@ export default {
29
32
},
30
33
data () {
31
34
return {
32
- textInput: ' '
35
+ textInput: " String to send "
33
36
}
34
37
},
35
38
methods: {
36
39
sendText () {
40
+ console .log (this .textInput )
37
41
this .$refs .myInstance .message (' Text' , ' SetText' , this .textInput )
38
42
}
39
43
}
You can’t perform that action at this time.
0 commit comments