Hello. I'm currently making games on android.
When I was trying to put a game that I wasn't originally trying to make on my smartphone into Android, I have a question.

Since it is a puzzle game originally made for a personal computer, for example, if you press A, it will be input input of "moveleft" of input and the script will be

if (Input.GetButtonUp ("moveleft")
{// move left}

I write all scripts in the form of


What I want to do now is to use a unity UI button, and when I press it, I want to move it to the left, that is, input "quote move left". I want to make it look like a semi-transparent button on the lower left, which is a 3D smartphone game.

Although it seems that you can pick up touch input from the coordinates of touch, you have to rewrite the script considerably, so I want to operate from the input of the button that I just said.

Are there any solutions or good ideas?

  • Answer # 1

    As you want to do
    1. How to create a translucent button
    2. I want to do input processing without changing the script much

    If you answer

    and answer

    If you check with the [Unity Button] as the first answer, there will be a lot about uGUI, so please refer to it
    So I think the OnClick function will come out.

    As the second answer

    if (Input.GetButtonUp ("moveleft")
    {// move left}
    That means
    All the actions that move to the left are made different functions.

    And I think it's better to put that function in this conditional statement and in the newly created OnClick function.