@@ -3,59 +3,59 @@ import UnityLoaderService from '../services/UnityLoaderService'
33import Styles from './Unity.styles'
44
55export default class Unity extends Component {
6- constructor ( props ) {
7- super ( props )
6+ constructor ( props ) {
7+ super ( props )
88 this . state = {
99 error : null
1010 }
11- this . _unityLoaderService = new UnityLoaderService ( )
11+ this . _unityLoaderService = new UnityLoaderService ( )
1212 }
13- componentDidMount ( ) {
14- this . _instantiate ( )
13+ componentDidMount ( ) {
14+ this . _instantiate ( )
1515 }
16- componentWillUnmount ( ) {
17- this . _unityLoaderService . unmount ( )
16+ componentWillUnmount ( ) {
17+ this . _unityLoaderService . unmount ( )
1818 }
19- _instantiate ( ) {
19+ _instantiate ( ) {
2020 let error = null
2121 if ( typeof this . props . loader === 'undefined' )
2222 error = 'Please provide Unity with a path to the UnityLoader in the loader prop.'
2323 if ( typeof this . props . src === 'undefined' )
2424 error = 'Please provide Unity with a path to a valid JSON in the src prop.'
2525
2626 if ( error !== null ) {
27- console . error ( error )
28- this . setState ( { error : error } )
29- }
27+ console . error ( error )
28+ this . setState ( { error : error } )
29+ }
3030 else {
31- this . _unityLoaderService . append ( this . props . loader ) . then ( ( ) => {
32- let unityInstance = UnityLoader . instantiate ( 'unity' , this . props . src , {
33- onProgress : this . _onProgress . bind ( this ) ,
34- Module : this . props . module
31+ this . _unityLoaderService . append ( this . props . loader ) . then ( ( ) => {
32+ let unityInstance = UnityLoader . instantiate ( 'unity' , this . props . src , {
33+ onProgress : this . _onProgress . bind ( this ) ,
34+ Module : this . props . module
3535 } )
3636 module . exports . UnityInstance = unityInstance
3737 } )
3838 }
3939 }
40- _onProgress ( unityInstance , progression ) {
40+ _onProgress ( unityInstance , progression ) {
4141 if ( typeof this . props . onProgress !== 'undefined' ) {
42- this . props . onProgress ( progression )
42+ this . props . onProgress ( progression )
4343 }
4444 }
45- _getContainerStyles ( ) {
45+ _getContainerStyles ( ) {
4646 return {
4747 width : this . props . width || '100%' ,
4848 height : this . props . height || '100%'
4949 }
5050 }
51- render ( ) {
51+ render ( ) {
5252 return (
53- < div className = 'unity' style = { this . _getContainerStyles ( ) } >
53+ < div className = 'unity' style = { this . _getContainerStyles ( ) } >
5454 { this . state . error !== null ? (
5555 < b > React-Unity-Webgl error { this . state . error } </ b >
56- ) : (
57- < div style = { Styles . unity } id = 'unity' > </ div >
58- ) }
56+ ) : (
57+ < div style = { Styles . unity } id = 'unity' > </ div >
58+ ) }
5959 </ div >
6060 )
6161 }
0 commit comments