0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Unity】WebGLでのツイート機能実装(Unity2019以降〜Unity6対応)

0
Last updated at Posted at 2025-08-02

はじめに

WebGLでリザルトのツイート機能を実装したい!
ということで ⬇️ のないち様がお作りになられたツイート機能を拝借してUnity6で実装したところエラーが出てうまくいかず...

調べたところ、Unity2019以降で削除されている関数を使用していたことが原因だったのでその解決方法を記述しています。

⬇️ ひとまずこちらのREADMEの手順通り進めてから下の解決方法を実行してみてください!

原因

スクリーンショット 2025-08-01 12.02.18.png
エラーを見るとpointer_stringifyはOpenWindowで定義されていないと記述されています。

このpointer_stringifyという関数ですが、Unity2019以降ではこの関数が削除されており、代わりにUTF8ToStringを使う必要がありました。

解決方法

OpenWindow.jslibを修正した

ファイルが配置されている場所 ⬇️
Assets>naichilab>unityroom-tweet>Plugins>WebGL>OpenWindow.jslib

OpenWindow.jslibを以下の内容に書き換える

mergeInto(LibraryManager.library, {
  OpenWindow: function (urlPtr) {
    var url = UTF8ToString(urlPtr);
    window.open(url, '_blank');
  }
});

以上

追記

後ほど気づいたのですが、こちらのissueでこの件が指摘されており、masterブランチのコードは修正されていました。

Releaseのunityパッケージには更新されておらず、README通り進めるとエラーが起きるので注意ですね。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?