facebook twitter hatena line email

「Unity/実機/WebGL」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページURL取得)
(Texture Streaming設定)
行31: 行31:
  
 
参考:https://docs.unity3d.com/ja/2019.4/Manual/TextureStreaming.html
 
参考:https://docs.unity3d.com/ja/2019.4/Manual/TextureStreaming.html
 +
 +
==DataCachingを使う==
 +
 +
使わない場合のファイル出力例
 +
<pre>
 +
webgl1.data.unityweb
 +
webgl1.framework.js.unityweb
 +
webgl1.loader.js
 +
webgl1.wasm.unityweb
 +
</pre>

2022年12月20日 (火) 17:59時点における版

Web(WebGL)で動かす

  • File/BuildSettingsを選択
  • WebGLを選択
  • OpenDownloadPageからプレイヤーをDL
  • Edit/ProjectSetting/Playerを選択しPlayerSettingsを開く
  • Inspector/HTML5マークタブ選択/OtherSetting
  • widthとheightを入力する
  • File/BuildSettingsからbuildボタンを押しプロジェクトを作成する
  • あとはlocalhost:xxxxxで勝手に開く

WebGLでchromeで表示時"exception thrown: RangeError: Maximum call"が出る場合

chromeの閲覧履歴を削除すればよい。

DevelopmentConsoleを出す

ビルド時に、WebGLの設定で、DevelopmentBuildを選択する。

公開ページURL取得

Debug.Log(Application.absoluteURL); // ttp://localhost:1234/?test=1にアクセスすると、そのままの文字列が出る。
// ドメイン判定は、ざっくりやると、こんな感じ
if (Application.absoluteURL.IndexOf("ttp://exmple.com") != -1) {
  // hit
}

Texture Streaming設定

  1. Unityメインメニュー/Edit/ProjectSetting/Quality/Texture Streamingをonへ
  2. Assets下の画像(png)ファイルとかのinspectorを開く
  3. TextureTypeがSpriteでなく、Defaultとかで、あることを確認。
  4. AdvancedのStreamingMipmapsをonへ

参考:https://docs.unity3d.com/ja/2019.4/Manual/TextureStreaming.html

DataCachingを使う

使わない場合のファイル出力例

webgl1.data.unityweb
webgl1.framework.js.unityweb
webgl1.loader.js
webgl1.wasm.unityweb