Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

UI buttons and if statement

edited August 2020 in Programming

Hello everybody, I'm a beginner and wanted to know can i check whether the player has pressed the UI button or not (using the if statement). PLEASE HELP, I am making a 3D game for android and iOS and want to use them to move the player from left to right. Brackey's touch controls video doesn't help as I want to move the player from left to right. There are a couple of videos on Youtube regarding this but they are for 2D and just do not work if I make the changes for 3D(they don't throw errors but they just don't work)

Best Answer

  • W_I_L_LW_I_L_L Member
    Accepted Answer

    Create a function for when the button is pressed. ex:

    void whenPressed()

    {

    //do something

    }

    Then, under the button component add a event under WhenPressed() by clicking the plus sign. After, drag in the script with the function and go under the drop down menu and select the script you wrote and then select the function you created.

Answers

  • did you tried EventTrigger…?

  • MichaElMichaEl Member
    edited August 2020

    Maybe u should make 2d game on mobile or 3d on pc. It would be simple

Sign In or Register to comment.