how to (Input.GetKeyDown(KeyCode.Space) => Input.GetTouch

how to (Input.GetKeyDown(KeyCode.Space) => Input.GetTouch

Originally my code was (Input.GetKeyDown(KeyCode.Space) Now I want to change the software to use on Android phones I heard that I want to use Input.GetTouch

How can I rewrite it (Input.GetKeyDown(KeyCode.Space) to change into Input.GetTouch

The essence of it is to break apart your current code first:

  • get the fact that the key was pressed, put it in a temporary variable

  • observe that variable and act on it.

Once you have that broken down, you insert a step between the two:

  • get the fact that a button onscreen was pressed, put it in that same temporary variable

You’re welcome to look in my proximity_buttons package for some random examples, but there’s plenty of other UI tutorials to look at as well.

Where is your proximity_buttons package

My bad! Forgot to paste the urls!

proximity_buttons is presently hosted at these locations:

https://bitbucket.org/kurtdekker/proximity_buttons

https://github.com/kurtdekker/proximity_buttons

https://gitlab.com/kurtdekker/proximity_buttons

https://sourceforge.net/projects/proximity-buttons/

You have so many files!
How do I know which one it is?
Can you give the URL directly?
Thank you

This post contains the steps you need:

For the button, either:

a) use a UnityEngine.UI.Button (the “standard” UI button)

or

b) look in my package and see if any of the button controls suit you

or

c) something else?