- Home /
Weird Input System situation
public void OnShootX(CallbackContext ctx)
{
if (ctx.performed)
IsShooting = true;
if (ctx.canceled)
IsShooting = false;
}
private void Update()
{
if(IsShooting)
{
Shoot();
} else
{
Debug.Log(IsShooting);
}
}
Hello! i want to adress a very weird issue i came across today, i'm making a shooter game and i want my player to be able to shoot rapidly by holding down a gamepad button. What's really weird is that when I Debug.log(IsShooting) in the if statement it continues sending it whereas my Shoot() function isnt getting repeated. I have my action set to "Press and Release"
Ironically (because most people over share) you aren't sharing enough of your code.
Answer by Rorrors · Dec 01, 2020 at 10:25 PM
if(IsShooting) this reads as "if its not shooting", then show debug.log
try with !: if(!IsShooting) and then the debug.log will always result false
so you will have to make a beter if statement
Your answer
Follow this Question
Related Questions
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
Is there something wrong with my 'Jump' input axis? 1 Answer
Show GUI.Button press state by keyboard input? 1 Answer
Help! Hiding/showing GUITextures! 1 Answer
Check if pressed key exists inside an array of KeyCodes 2 Answers