Monday, December 21, 2015

Touchcount on Unity

I am confused. This seems to be a feature, yet I do not see any caveats listed as to what it does and doesn't do. For example what does it not work on, what are its known bugs etc.

I mentioned in previous posts that I got the game to run on my Kindle Fire. Well I think that the best way to present the game to people would be on a nice tablet. I am even looking around to a good deal on a 10 inch and larger Android tablet, so far I am still looking. This means that I have some immediate work to do... like getting the interface fully functional on the tablets.

As I have already done version 2 of the click to move control, I figured it was time to get the 'USE' functionality working. Using stuff in the game is the second most important function after movement and allows you to interact with Doors and also NPCs (to obtain quests etc). So I want to use a Double Tap method. Sounded easy and I was going to write my own when I realized that literally thousands of games must use this, so the functionality should be standard in Unity 3d.

Well they do have 'Input.touchCount', which doesn't appear to work for me on the PC using the mouse. Why a Mouse click would be different to a touch has me a bit baffled. However I implemented the touchCount code, even though I found many questions about this feature NOT working on Android. Then when I ran the game it simply worked.

if (Input.touchCount == 2) {

It worked!. Why is there all this info on the Web about this feature not working I wonder?

If you need this functionality I would recommend you try this as it is fast and easy to try before you worry about rolling your own.

Happy Holidays,
Da Voodoochief

No comments:

Post a Comment