Hello!
We are trying to make a port to Android, but we are having some issues with our customized version of the UnityPaint script from the wiki:
- Our current solution works as expected on UnityRemote 4 and draws wherever you tap on brush and eraser mode, but the actual build only draws straight lines (another feature of UnityPaint) and will sometimes not recognize a tap. We put debug.logs on every step of the draw process when we had the same problem with Unity Remote, and fixed it so it would always call the GetKey equivalent function, as it seemed to miss the beginning of some touch events.
- When trying to transfer the drawings to the PC version or between Android devices with different sized screens, the drawing shows up in the wrong location.
We are using Unity 4.5, and our current target is API15 on a Nexus 7. The following is the equivalents we had to use for porting the PC build to Android:
if (Input.touchCount > 0 )
//Equivalent: if (Input.GetKeyDown ("mouse 0"))
if (Input.touchCount>0 && Input.GetTouch(0).phase == TouchPhase.Stationary)//Also TouchPhase.Moved
//Equivalent: if (Input.GetKey ("mouse 0"))
if(Input.touchCount>0 && Input.GetTouch(0).phase == TouchPhase.Ended && dragStart != Vector2.zero)
//Equivalent: if(Input.GetKeyUp ("mouse 0") && dragStart != Vector2.zero)