Dan*_*lov 11 unity-game-engine reactjs react-native unity-webgl
我用webgl编写了简单的本机应用程序.我使用了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" />`
);
}
Run Code Online (Sandbox Code Playgroud)
但我有以下错误
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)
Run Code Online (Sandbox Code Playgroud)
有没有简单的方法将统一webgl放在我的反应原生中?
你必须导入 React,然后document尝试react-native一下它会解决你的问题,并且确保你下载与你的 Unity 版本匹配的版本。
import React, {Component} from 'react';
import {View,document} from 'react-native';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
818 次 |
| 最近记录: |