Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL以外ではOpenWindow()が無効のためIL2CPPがエラーになるので、プラットフォーム依存 #define で囲って回避 #4

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Assets/naichilab/unityroom-tweet/Scripts/UnityRoomTweet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ namespace naichilab
{
public static class UnityRoomTweet
{
#if UNITY_WEBGL
[DllImport("__Internal")]
private static extern void OpenWindow(string url);
#endif

private static YieldInstruction _currentCoroutine = null;

Expand Down Expand Up @@ -62,10 +64,12 @@ private static void Tweet(string tweetUrl)
{
if (Application.platform == RuntimePlatform.WebGLPlayer)
{
#if UNITY_WEBGL
#if UNITY_2017_2_OR_NEWER
OpenWindow(tweetUrl);
#else
Application.ExternalEval ("var F = 0;if (screen.height > 500) {F = Math.round((screen.height / 2) - (250));}window.open('" + tweetUrl + "','intent','left='+Math.round((screen.width/2)-(250))+',top='+F+',width=500,height=260,personalbar=no,toolbar=no,resizable=no,scrollbars=yes');");
#endif
#endif
}
else
Expand Down