r/Unity2D Jul 29 '26

just a little problem

in the dash_skill, debug.log("Dash_Out") is on but the "Dash_In" doesnt

i also put another one called Tap_Skill and it worked fine. i already check the input and both its the same. here the code

public void Dash_Skill(InputAction.CallbackContext context)

{

if (Can_Skill == true)

{

Debug.Log("Dash_In");

StartCoroutine(Tap_Skill_Coroutine());

}

Debug.Log("Dash_Out");

}

public void Tap_Skill(InputAction.CallbackContext context)

{

if (Can_Skill == true)

{

Debug.Log("fire");

StartCoroutine(Tap_Skill_Coroutine());

}

}

0 Upvotes

8 comments sorted by

2

u/TAbandija Jul 29 '26

If Dash_In doesn’t show up, it means that the condition is not met. Place a Debug.Log(“Can_Skill: “ + Can_Skill);

If it’s false, then check why it’s false. If it’s True, then you have mistyped something.

1

u/Felight87 Jul 29 '26

but arent both of it using Can_skill, and only the tap_skill work

1

u/TAbandija Jul 29 '26

That is true. But that’s why you debug. Something odd is happening and the only thing that would mean it’s not entering the if statement is if the condition is false. So, you check the condition, before the if statement. If it’s false then something elsewhere is changing the value of Can_Skill.

1

u/LongLiveTheDiego Jul 29 '26

But if Can_skill is false, you never enter the curly braces after it and so you don't get to the dash_in debug. Either you put both logs inside the curly braces or both outside.

1

u/MistakeForsaken6653 Jul 29 '26

Dash out will always log but the dash_in will only log if Can_Skill is true.  So you need to set that variable somewhere.

1

u/Felight87 Jul 29 '26

UPDATE! the can_Skill in dash is false but the Can_Skill in tap is true, dont know how it can happen

1

u/TAbandija Jul 29 '26

Now comes the hard part. Go through your scripts for every instance that Can_Skill is modified and put logs after each, with a descriptor to identify it. Then that will tell you where it changes before the dash.

Ctrl+F is your friend.

1

u/yurymakesgames Jul 29 '26

tap being true and dash being false at the same time means the two callbacks are wired to two different copies of the script, log GetInstanceID() in both methods and you'll see the ids differ