Skip to content

Instantly share code, notes, and snippets.

@kimukou
kimukou / SignalWatcher.java
Created August 28, 2017 14:52
SignalWatcher extends code
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import permissions.dispatcher.PermissionUtils;
/*
@paosidufygthrj
paosidufygthrj / crossdomain.md
Created November 11, 2015 10:17
クロスドメイン制約

クロスドメイン制約

HTMLでXMLHttpRequestを利用したHTTP通信のクロスドメイン制約の概要についてのまとめです。
Emscripten, Unity(WebGL,WebPlayer),Flashなどで問題の発生が予測されます。

XMLHttpRequest

XMLHttpRequest(以下XHR)はブラウザで既に読み込み済みのページからさらにHTTP通信を行うAPIです。

しかしXHRはセキュリティ上の理由でリクエスト先がHTMLファイルと同じドメインでなければいけないという制約があります。

@GOROman
GOROman / GetSSID.cs
Last active November 11, 2020 08:33
UnityからAndroidのWifi情報を得る(SSIDとか)
// AndroidManifest.xml に <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> の設定が必要
string GetSSID()
{
string ssid = "N/A";
using (var activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity")) {
var wifiManager = activity.Call<AndroidJavaObject>("getSystemService", "wifi");
ssid = wifiManager.Call<AndroidJavaObject>("getConnectionInfo").Call<string>("getSSID");
}
@xVir
xVir / unity_https_problem.md
Last active April 21, 2016 05:37
Unity problem with HTTPS

Another problem I faced with while development of Unity plugin is Exception while HTTP request from the iOS platform. It produces such stacktrace:

ExecutionEngineException: Attempting to JIT compile method 'System.Reflection.MonoProperty:GetterAdapterFrame<Mono.Security.Protocol.Tls.HttpsClientStream, bool> (System.Reflection.MonoProperty/Getter`2<Mono.Security.Protocol.Tls.HttpsClientStream, bool>,object)' while running with --aot-only.

  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0 
  at System.Net.WebConnection.Write (System.Net.HttpWebRequest request, System.Byte[] buffer, Int32 offset, Int32 size, System.String& err_msg) [0x00000] in <filename unknown>:0 
  at System.Net.WebConnectionStream.WriteHeaders () [0x00000] in <filename unknown>:0 
  at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer) [0x00000] in <filename unknown>:0 
 at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error) [0x000
Unite
----------------------------------------------------------------------
1:開場
 ・ かなりの待機列
 ・ ノベリティと名札を受け取って入場
 ・ 開場は3つの開場を繋げた形で椅子や様子はデブサミに近い。
 ・ Unity関連のゲームやツールの動画が続々と流されている。音響もよい。
 ・ アナウンスがアニメ声
 ・ 同時通訳機と水が椅子に用意されていた。
@tsubaki
tsubaki / UnityAppController.mm
Created December 12, 2013 01:17
ディクテーションでUnityが落ちる対策。Unityが出力したファイルのUnityAppController.mmのrepaintメソッドのSetupUnityDefaultFBOの上にEAGLContextSetCurrentAutoRestore云々の部分を追加する
- (void)repaint
{
EAGLContextSetCurrentAutoRestore autorestore(_mainDisplay->surface.context);
SetupUnityDefaultFBO(&_mainDisplay->surface);
// ...
}
using UnityEngine;
using UnityEditor;
using System.Collections;
public class CreateMesh {
//16250枚Quadが入ったMeshを作る。
[MenuItem("Custom/Create/16250meshes")]
public static void CreateParticleMesh(){
Mesh mesh = new Mesh();
int vertexCount = 65000;
@tsubaki
tsubaki / SceneSave.cs
Last active December 28, 2015 18:29
プレイモード切替時にプレハブを保存する。使用するにはEditorフォルダ以下に配置しておく。
using System.Collections;
using UnityEditor;
[InitializeOnLoad]
public class SceneSave
{
static SceneSave ()
{
EditorApplication.playmodeStateChanged = () =>
{