Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Trying to create a button on mobile for Fire1

Discussion in 'Scripting' started by ersaurabh101, Feb 6, 2012.

  1. ersaurabh101

    ersaurabh101

    Joined:
    Oct 8, 2010
    Posts:
    412
    Hii,

    I have added an fps [mobile] in my scene, problem is tapping on LeftTouchPad or RightTouchPad is causing my weapon to shoot.

    I have added a script

    if (Input.GetButton ("Fire1"))
    BroadcastMessage("Fire");

    Now in my Project Settings > Input My Fire1 settings says
    Joy num = Get motion from all joysticks

    i Want to create a button on screen, tapping which Fire1 should work..

    Please advise..
     
  2. ersaurabh101

    ersaurabh101

    Joined:
    Oct 8, 2010
    Posts:
    412
    help any1
     
  3. pezz

    pezz

    Joined:
    Apr 29, 2011
    Posts:
    606
    GUI buttons wont work for this. As the only allow one input at a time.

    Try using a Gui Texture. Then use hit texture.
     
  4. masudias

    masudias

    Joined:
    Oct 15, 2011
    Posts:
    37
    Input.GetMouseButtonDown() works for mobile i think. You can use that function with correct cursor position.

    Thanks,
    _Masudias
     
  5. ersaurabh101

    ersaurabh101

    Joined:
    Oct 8, 2010
    Posts:
    412
    kk i have found and reached till here ---

    and what does (variable declarations ommitted) means here...can any1 help me.
     
  6. AiDev123

    AiDev123

    Joined:
    Sep 7, 2016
    Posts:
    16
    this is very old, but did anyone here figure this out? I'm still having this problem