【发布时间】:2018-11-22 00:08:06
【问题描述】:
我使用 WebGL 编写了一个简单的 React Native 应用程序。 我用https://github.com/JilvanPinheiro/reactive-native-unity-webgl
import Unity from 'react-native-unity-webgl';
...
render() {
return (
<Unity
width="500px"
height="350px"
onProgress={ this.onProgress }
src="http://192.168.1.101/Build/Ultimatum.json"
loader="http://192.168.1.101/Build/UnityLoader.js" />`
);
}
但我收到以下错误:
ReferenceError: Can't find variable: document. This error is located at:
in Unity (at App.js:9)
in RCTView (at View.js:60)
in View (at App.js:8)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
有没有更简单的方法将 Unity webGL 放置在我的 React Native 应用程序中?
【问题讨论】:
-
在您链接的站点的文档中看到了这个:
The path within your src and loader should be relative to the html file your app is running in.您不完整示例中的...是否包含export class App extends React.Component {?
标签: reactjs unity3d react-native unity-webgl