万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    AndroidとかでFingureGestureプラグインバグる Unity3.5.x

    URL: http://forum.fatalfrog.com/index.php?topic=252.15

    Touch.fingerId は変な値が返るらしい

    ・TouchScreenGesture.cs

    public bool fixAndroidTouchIdBug = true;
    	int touchIdOffset = 0;
    	
        void UpdateFingerTouchMap()
        {
            for( int i = 0; i < finger2touchMap.Length; ++i )
                finger2touchMap[i] = -1;
    		
    	// Android: work around strange Touch.fingerId values after resuming application. 
    	// Not sure yet if this is a Unity bug or OS/Hardware issue with some android devices
    	// e.g. the first touch on the screen can return a fingerId greater than 0 (4, 5... even 32 has been seen!)
    	#if UNITY_ANDROID
    	if( fixAndroidTouchIdBug )
    	{
    		if( Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began )
    			touchIdOffset = Input.touches[0].fingerId;
    	}
    	#endif
    		
            for( int i = 0; i < Input.touchCount; ++i )
            {
                int fingerIndex = Input.touches[i].fingerId - touchIdOffset;
    
                if( fingerIndex < finger2touchMap.Length )
                    finger2touchMap[fingerIndex] = i;
            }
        }
    

    UpdateFingerTouchMapメソッドをこれに置き換えればいいようだ