I am creating a game for android with unity program , and I want to touch the screen would make the action of attacking or pressing a button created to attack , if someone could give me a script for my problem would appreciate,thanks.
To make a simple attack button, use Unity’s GUI and put your attack code in a method, like this:
public void Attack(){
//Attack Code Goes Here
}
void OnGUI(){
if(GUI.Button(new Rect(0, 0, 30, 30), "ATTACK")){
Attack();
}
}
Of course, you should really put the factors used here into variables and use screen divisions to position the button.