Skip to content

Commit 6c6c6a7

Browse files
author
Jeffrey Lanters
authored
Merge branch 'master' into development
2 parents e2e06f6 + f2f0440 commit 6c6c6a7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# React Unity WebGL
22
When building content for the web, you might need to communicate with other elements on React Application. Or you might want to implement functionality using Web APIs which [Unity](https://unity3d.com) does not currently expose by default. In both cases, you need to directly interface with the browser’s JavaScript engine. React Unity WebGL provides an easy library for Unity 5.6 / 2017 or newer with different methods to do this.
33

4-
<img src="https://raw.githubusercontent.com/jeffreylanters/react-unity-webgl/master/resources/readme/logo.png" width="300px">
4+
<img src="https://raw.githubusercontent.com/jeffreylanters/react-unity-webgl/master/resources/readme/logo.png" width="300px"><br />
55

6-
<img src="https://raw.githubusercontent.com/jeffreylanters/react-unity-webgl/master/resources/readme/demo.gif" width="300px">
6+
<img src="https://raw.githubusercontent.com/jeffreylanters/react-unity-webgl/master/resources/readme/demo-video.gif" width="300px">
77

88

99

@@ -41,8 +41,8 @@ $ npm install react-unity-webgl
4141
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).
4242

4343
```js
44-
import React from 'react';
45-
import Unity from 'react-unity-webgl';
44+
import React from 'react'
45+
import Unity from 'react-unity-webgl'
4646

4747
export class App extends React.Component {
4848
render () {
@@ -92,12 +92,12 @@ SendMessage (objectName, methodName, value);
9292

9393
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:
9494
```js
95-
import React from 'react';
96-
import { SendMessage } from 'react-unity-webgl';
95+
import React from 'react'
96+
import { SendMessage } from 'react-unity-webgl'
9797

9898
export class App extends React.Component {
9999
spawnEnemy (count) {
100-
SendMessage ('SpawnBehaviour', 'SpawnEnemies', count);
100+
SendMessage ('SpawnBehaviour', 'SpawnEnemies', count)
101101
}
102102
render () {
103103
return <div onClick={ this.spawnEnemy.bind(this, 5) }>
@@ -127,15 +127,15 @@ RegisterExternalListener (methodName, callback);
127127
```
128128
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:
129129
```js
130-
import React from 'react';
131-
import { RegisterExternalListener } from 'react-unity-webgl';
130+
import React from 'react'
131+
import { RegisterExternalListener } from 'react-unity-webgl'
132132

133133
export class App extends React.Component {
134134
constructor () {
135-
RegisterExternalListener ('OpenMenu', this.openMenu.bind (this));
135+
RegisterExternalListener ('OpenMenu', this.openMenu.bind (this))
136136
}
137137
openMenu (menuId) {
138-
console.log (`opening menu with id ${menuId$}`);
138+
console.log (`opening menu with id ${menuId$}`)
139139
}
140140
}
141141
```
File renamed without changes.

0 commit comments

Comments
 (0)