You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-12Lines changed: 6 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,8 +27,7 @@ When building content for the web, you might need to communicate with other elem
27
27
28
28
29
29
30
-
<br/><br/>
31
-
---
30
+
<br/><br/><br/>
32
31
# Installation
33
32
Install using npm. Make sure you download the release matching with your Unity version. I try to update this plugin in case of need as fast as possible. Check the [releases on GitHub](https://github.com/jeffreylanters/react-unity-webgl/releases) for the corresponding version or [view on NPM](https://www.npmjs.com/package/react-unity-webgl).
34
33
@@ -39,8 +38,7 @@ $ npm install react-unity-webgl
39
38
40
39
41
40
42
-
<br/><br/>
43
-
---
41
+
<br/><br/><br/>
44
42
# Usage
45
43
To get started import the default Unity class from react-unity-webgl and include it in your render while giving the public path to your src and loader files. [Best practices for adding the src and loader files on a public path](#best-practices-for-adding-the-src-and-loader-files-on-a-public-path).
46
44
@@ -86,8 +84,7 @@ this.myCustomModule = { ... }
86
84
87
85
88
86
89
-
<br/><br/>
90
-
---
87
+
<br/><br/><br/>
91
88
# Calling Unity scripts functions from JavaScript in React
92
89
Sometimes you need to send some data or notification to the Unity script from the browser’s JavaScript. The recommended way of doing it is to call methods on GameObjects in your content. To get started import the function SendMessage from react-unity-webgl.
93
90
@@ -124,8 +121,7 @@ public class SpawnController: MonoBehaviour {
124
121
125
122
126
123
127
-
<br/><br/>
128
-
---
124
+
<br/><br/><br/>
129
125
# Calling JavaScript functions within React from Unity scripts
130
126
We also allow you to call JavaScript functions within React from the Unity Content. To get started import the function RegisterExternalListener from react-unity-webgl.
131
127
```js
@@ -177,8 +173,7 @@ public class MenuController: MonoBehaviour {
177
173
178
174
179
175
180
-
<br/><br/>
181
-
---
176
+
<br/><br/><br/>
182
177
# Notes
183
178
## Best practices for adding the src and loader files on a public path
184
179
Make sure your Unity build is in your public folder, this is due to the component **and** Unity itself will load files in Runtime and not Compile/Bundle time. The public folder means that the folder should be accesible via a public web adress. The path within your `src` and `loader` should be relative to the html file your app is running in.
@@ -191,7 +186,6 @@ Simple numeric types can be passed to JavaScript in function parameters without
191
186
192
187
193
188
194
-
<br/><br/>
195
-
---
189
+
<br/><br/><br/>
196
190
# Contributing
197
191
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. Before commiting, please compile your code using `npm run compile` and open a pull request. Thank you very much!
0 commit comments