Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions library/components/Unity.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ var _UnityLoaderService = require('../services/UnityLoaderService');

var _UnityLoaderService2 = _interopRequireDefault(_UnityLoaderService);

var _Unity = require('./Unity.styles');

var _Unity2 = _interopRequireDefault(_Unity);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
Expand Down Expand Up @@ -65,11 +61,12 @@ var Unity = function (_Component) {
this.setState({ error: error });
} else {
this._unityLoaderService.append(this.props.loader).then(function () {
var unityInstance = UnityLoader.instantiate('unity', _this2.props.src, {
var unityInstance = UnityLoader.instantiate('__ruw', _this2.props.src, {
onProgress: _this2._onProgress.bind(_this2),
Module: _this2.props.module
});
module.exports.UnityInstance = unityInstance;
window._ui = unityInstance;
});
}
}
Expand Down Expand Up @@ -99,7 +96,7 @@ var Unity = function (_Component) {
null,
'React-Unity-Webgl error ',
this.state.error
) : _react2.default.createElement('div', { style: _Unity2.default.unity, id: 'unity' })
) : _react2.default.createElement('div', { style: { width: '100%', height: '100%' }, id: '__ruw' })
);
}
}]);
Expand Down
8 changes: 5 additions & 3 deletions library/services/UnityLoaderService.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ var UnityLoaderService = function () {
}, {
key: 'unmount',
value: function unmount() {
if (this.unityLoaderScript !== null) {
this.documentHead.removeChild(this.unityLoaderScript);
}
/// unmounting is disabled due to bug
/// https://github.com/jeffreylanters/react-unity-webgl/issues/22
// if (this.unityLoaderScript !== null) {
// this.documentHead.removeChild(this.unityLoaderScript)
// }
}
}]);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-unity-webgl",
"version": "6.4.3",
"version": "6.4.4",
"description": "A Unity WebGL component for your React application",
"main": "library/index.js",
"types": "./types.d.ts",
Expand Down
11 changes: 5 additions & 6 deletions source/components/Unity.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react'
import UnityLoaderService from '../services/UnityLoaderService'
import Styles from './Unity.styles'

export default class Unity extends Component {
constructor(props) {
Expand Down Expand Up @@ -29,7 +28,7 @@ export default class Unity extends Component {
}
else {
this._unityLoaderService.append(this.props.loader).then(() => {
let unityInstance = UnityLoader.instantiate('unity', this.props.src, {
let unityInstance = UnityLoader.instantiate('__ruw', this.props.src, {
onProgress: this._onProgress.bind(this),
Module: this.props.module
})
Expand All @@ -51,11 +50,11 @@ export default class Unity extends Component {
render() {
return (
<div className='unity' style={this._getContainerStyles()}>
{this.state.error !== null ? (
{this.state.error !== null ?
<b>React-Unity-Webgl error {this.state.error}</b>
) : (
<div style={Styles.unity} id='unity'></div>
)}
:
<div style={{ width: '100%', height: '100%' }} id='__ruw'></div>
}
</div>
)
}
Expand Down
6 changes: 0 additions & 6 deletions source/components/Unity.styles.js

This file was deleted.

8 changes: 5 additions & 3 deletions source/services/UnityLoaderService.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export default class UnityLoaderService {
})
}
unmount() {
if (this.unityLoaderScript !== null) {
this.documentHead.removeChild(this.unityLoaderScript)
}
/// unmounting is disabled due to bug
/// https://github.com/jeffreylanters/react-unity-webgl/issues/22
// if (this.unityLoaderScript !== null) {
// this.documentHead.removeChild(this.unityLoaderScript)
// }
}
}