Home android Character Management on Android Unity3D 4.6? (C #)

Character Management on Android Unity3D 4.6? (C #)

Author

Date

Category

Hello.
I make a game on unity3d 4.6.
Made the game, everything is fine on the PC, control on the clave works, but I need to manage to make on Android, but I can not. Help me please.
Here is my script, the movement is performed by pressing the button (Keydown) and the button to be released:

void update () {
  If (MovePlayer) {
    // Vice
    If (Grounded & Amp; & amp; (Input.GetKeyDown (keycode.uparrow))) {
      // Strebok
      rigidbody2d.addforce (new vector2 (0f, jumpforce));
      // turn on Animatsiya Strebka
      Anim.SetBool ("Jump", False);
      // Coordinates Kolidera
      Boxcollider.size = new vector2 (1.6f, 0.48f);
      boxcollider.center = new vector2 (-0.08f, -0.71f);
    }
    // Sature
    if (input.getKeydown (keycode.downarrow)) {
      // Include Animatsia Podinanny
      Anim.SetBool ("Leam", True);
      // Coordinates Kolidera
      boxcollider.size = new vector2 (2.0f, 1.5f);
      Boxcollider.center = new vector2 (0.23F, -0.1F);
    }
    if (! Grounded & amp; & amp; (Input.GetKeyUp (keycode.uparrow))) {
      // Coordinates Kolidera
      Boxcollider.size = new vector2 (0.54F, 2.89F);
      boxcollider.center = new vector2 (-0.06f, 0.19f);
    }
    if (input.getKeyup (keycode.downarrow)) {
      // Prinuchant Animatsiya Podinanny
      Anim.SetBool ("Leam", False);
      // Coordinates Kolidera
      Boxcollider.size = new vector2 (0.54F, 2.89F);
      boxcollider.center = new vector2 (-0.06f, 0.19f);
    }
    // Turning to the Catherine Gri
    if (input.GetKey (keycode.r))
    {
      Application.Loadlevel (Application.loadEDlevel);
    }
  }
}

Answer 1, Authority 100%

  1. create canvas on the
  2. screen

  3. is placed there any object that reacts to the click of the finger. (Must have “Raycast Target” and it must be set to “True”) – for example image.
  4. Well, on the relevant Reikasta, you call the appropriate code block / method.

But it will not help if you need to do swipes. Swiles are made differently.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions