Skip to content

Commit f2f0440

Browse files
Updated readme
1 parent 5f6ab8b commit f2f0440

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ $ npm install react-unity-webgl
4040
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.
4141

4242
```js
43-
import React from 'react';
44-
import Unity from 'react-unity-webgl';
43+
import React from 'react'
44+
import Unity from 'react-unity-webgl'
4545

4646
export class App extends React.Component {
4747
render () {
@@ -91,12 +91,12 @@ SendMessage (objectName, methodName, value);
9191

9292
Where objectName is the name of an object in your scene; methodName is the name of a method in the script, currently attached to that object; value can be a string, a number, or can be empty. For example:
9393
```js
94-
import React from 'react';
95-
import { SendMessage } from 'react-unity-webgl';
94+
import React from 'react'
95+
import { SendMessage } from 'react-unity-webgl'
9696

9797
export class App extends React.Component {
9898
spawnEnemy (count) {
99-
SendMessage ('SpawnBehaviour', 'SpawnEnemies', count);
99+
SendMessage ('SpawnBehaviour', 'SpawnEnemies', count)
100100
}
101101
render () {
102102
return <div onClick={ this.spawnEnemy.bind(this, 5) }>
@@ -126,15 +126,15 @@ RegisterExternalListener (methodName, callback);
126126
```
127127
Where methodName is the name of a method in the script, this method will be binded to the current browser window so Unity can refer to it; callback canwill be a function, which takes one parameter with the value passed by your content. Note that it is recommended to register the callbacks before loading the Unity content. For example:
128128
```js
129-
import React from 'react';
130-
import { RegisterExternalListener } from 'react-unity-webgl';
129+
import React from 'react'
130+
import { RegisterExternalListener } from 'react-unity-webgl'
131131

132132
export class App extends React.Component {
133133
constructor () {
134-
RegisterExternalListener ('OpenMenu', this.openMenu.bind (this));
134+
RegisterExternalListener ('OpenMenu', this.openMenu.bind (this))
135135
}
136136
openMenu (menuId) {
137-
console.log (`opening menu with id ${menuId$}`);
137+
console.log (`opening menu with id ${menuId$}`)
138138
}
139139
}
140140
```

0 commit comments

Comments
 (0)