UE4在安卓端获取输入信息时候,似乎会把触摸事件和PC端的鼠标事件弄混在一起,导致出现一些奇怪的问题。
1. /* 安卓端会把触摸事件读取成PC端的鼠标事件,因为Turn和LookUp在PC端开发时候一般都绑定在鼠标X轴,Y轴上,
* 所以这里要对安卓端做一些特殊处理。
*/
#if !PLATFORM_ANDROID
PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
#endif
2. 在列表中放置按钮时候因为需要把按钮的 ClickMethod设置为 PreciseClick,这样才能在左键拖动鼠标时候滑动列表。对应的在移动端设备中则应该修改TouchMethod为 PreciseTap,这样才能滑动列表,但是同理因为安卓端的问题,该处地方 ClickMethod 不能为PreciseClick,改为 DownAndUp就好。
如若不然,可能会导致个别奇怪问题,比如某个地方的按钮不能接收到ClickEvent。
3.在PlayerController的InputTouch函数中获取到的TouchLocation时,TouchBegin和TouchMove消息获取的位置比TouchEnd的位置大1.5倍。而且通过PlayerInputComponent绑定的TouchEnd消息不能触发。
bool AMyPlayerController::InputTouch(uint32 Handle, ETouchType::Type Type, cons