Created
June 1, 2012 00:48
-
-
Save ToQoz/2847659 to your computer and use it in GitHub Desktop.
UnityのWebView(unity-webview-integration使う)でローカルHTMLを見るやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.html は Assets/StreamingAssetsにあるとする. | |
// Android | |
// HTMLをテキストとして送る. -> ださい | |
www = new WWW("jar:file://" + Application.dataPath + "!/assets/index.html"); // this is the path to your StreamingAssets in android | |
yield www; | |
if(www.isDone){ | |
WebMediator.LoadData(www); // 独自で追加したメソッド, ネイティブプラギン側でWebView.loadData呼び出してる. | |
} | |
// やばい簡単 しかもルートディレクトリ設定されるから外部CSSとかJSとかも普通に読める | |
// あと注意は javascriptファイルを .js としてしまうとUnityがコンパイルしようとしてエラーでビルドできないから | |
// 適当に拡張子を .js_ とかにしておく | |
WebMediator.LoadUrl("file:///android_asset/index.html"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment