Search Unity

Micro FPS Tutorial Problem

Discussion in 'Getting Started' started by mrpres_ident, Oct 28, 2019.

  1. mrpres_ident

    mrpres_ident

    Joined:
    Oct 28, 2019
    Posts:
    3
    I just finished the Micro FPS tutorial and uploaded the WebGL like it showed me...twice. And, both times, whenever I press the start button the gun auto-fires as soon as the game starts, and doesn't stop. I uploaded it twice because I thought it might have been a compile or upload error, but since it's doing it on the second upload, I have no idea what could be the problem. Does anyone have an idea what I could be? Below is a link to the game.

    https://connect.unity.com/p/myfirstfpsgame-1
     
  2. mrpres_ident

    mrpres_ident

    Joined:
    Oct 28, 2019
    Posts:
    3
    It's hard to believe that no one has any input on this....i guess i should assume this is an isolated indecent. Really sucks cause i was almost proud of making this little game, even if it is insignificant.
     
  3. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    I’ve just played your game three times and it worked as it should, i.e. the gun only fired when I pressed the left mouse button (no auto-firing).
     
  4. mrpres_ident

    mrpres_ident

    Joined:
    Oct 28, 2019
    Posts:
    3
    Thank you very much. I feel slightly embarrassed now. But, with your feed back i found that it apparently has something to do with my Firefox browser. I was finally able to try it on a different PC, and as you've said, it works just fine....so, now i need to figure out what's wrong with my browser...despite it being up-to-date. I guess it goes to show why games (or software in general) should be tested on more than one device.
     
  5. HiddenRedJack

    HiddenRedJack

    Joined:
    Nov 25, 2019
    Posts:
    1
    well i tried your game but its black i cant see a thing. i left some comments but the gun was fine for me. even though I couldnt see it
     
  6. AlexJGilpin

    AlexJGilpin

    Joined:
    Nov 27, 2019
    Posts:
    1
    mrpres_ident, I figured it out! I googled and found: https://answers.unity.com/questions/1314022/inputgetmousebuttondown-not-working-on-webgl-build.html

    I checked PlayerInputHandler in my own version of the FPS game and noticed on line 100 to 104:
    Code (CSharp):
    1. bool isGamepad = Input.GetAxis(GameConstants.k_ButtonNameGamepadFire) != 0f;
    2.             if (isGamepad)
    3.             {
    4.                 return Input.GetAxis(GameConstants.k_ButtonNameGamepadFire) >= triggerAxisThreshold;
    5.             }
    So I disconnected a controller I had plugged in to my computer and tried to play your game again. Sure enough, the automatic firing stopped. I'm betting some gamepad types read the default ButtonNameGamepadFire control as not equaling 0f by default, and this caused the game to think "okay, well, the gamepad is firing. better keep firing!"
     
  7. AQUEST

    AQUEST

    Joined:
    Dec 21, 2019
    Posts:
    1
    i didnt change anything. but these errors appear. anyone understand why?
     

    Attached Files: