分享您的推广链接,轻松获得分享积分,让更多人都分享

推广链接格式:http://www.idoubi.net?mref=您的账户名

Unity3D 官方原生触摸插件 Native Touch

Native Touch – Faster touch via callbacks from the OS, with a real hardware timestamp.
Official Website | Ask questions in the forum | Discord

“Native Touch reports faster touch event directly to Unity via callbacks. Make fair performance judgement with a real hardware touch timestamp.”

Your Unity game could be much more responsive

Did you feel like your app is more sluggish, has much worse perceived latency, or oddly not as satisfying as other apps installed on the same device? The common sayings is that because Unity adds more audio latency, but did you know you are able to improve the input latency as well?

Responsive game translates to more 5 stars reviews for those who didn’t care to write a review for you before. Existing 5 stars reviewers already has something specific to say, but things like snappiness and responsiveness must be felt. For players, it is probably hard to explain what’s exactly the cause of this “fun experience” they are getting but they will come to your review page and just say that the game was fun. For us, it is time to make that magic happen by reducing latency.

The real native touch timestamp

You used to “poll” for touch in Unity via Input.___ but did you know when exactly those touches were made? We are forced to use in-frame time based on asking Time.realTimeSinceStartup or calculating from Time.deltaTime for so long since the creation of Unity that we feel was such a natural thing to do.

By that, however, you are assuming the touch happened right there at that line of code (Time.realTimeSinceStartup) or at the beginning of this frame (Time.deltaTime). Neither are true because for the touch to be available for polling right now it must had happened somewhere in the previous frame. This is also a weakness of polling-based API.

And so, in timing-based game you are favoring early-pressing players and punishing late-pressing players because rather than the time they touch the screen you are using the time in the next nearest frame.

Recover lost data

What you get from Input.touches is only an interpretation of all the native callbacks that may happen more than 1 time before this frame. On both iOS and Android Unity has its own interpretation algorithm which “summarize” the callbacks but unfortunately discarded some movement details. With Native Touch, we will get all of the original movements reported by the OS.Benefit highlights

??At least 1 frame faster input.
??Unexpectedly translates to better “perceived” audio latency.
??Fair judgement with a real hardware touch timestamp.
??Native fields, all available.
??Recover lost data.
??Unity touch still works.

Head to the website for many things not mentioned here. With implementation details how this plugin was made explained to the point that you could make it yourself, research articles, and much more.

更多推荐