If player is not holding the ladder then it should not jump twice

I am using Unity2d and I am stuck with a problem. In my game I gave the player a double jump ability. I want to the player to jump twice only if they hold the ladder.

The problem is that if the player jumps through the ladder without holding the ladder, it jumps twice (as if the user presses jump key twice) I want the player to only double if player holding the ladder and then presses jump. If the player just jumps through the ladder it should not jump twice.

Below is the player script:

[SerializeField]  [SerializeField] float _xSpeed = 1f; [SerializeField] float _ySpeed = 1f; [SerializeField] float _jumpForce = 1f; [SerializeField] float _distance; [SerializeField] LayerMask _ladderLayer; private float _horizontalMovement; private float _verticalMovement; private Rigidbody2D _rb; private bool _isClimbing; private bool _isMovingHorizontal = true;    [SerializeField] Transform _groundPos; [SerializeField] float _checkRadius; [SerializeField] LayerMask _groundLayer; private bool _isGrounded;    // ExtraJump private int _extraJumps; [SerializeField] int _extraJumpValue = 1;   void Start() {     _rb = GetComponent<Rigidbody2D>();     _extraJumps = _extraJumpValue;  }   void Update() {     _horizontalMovement = Input.GetAxis("Horizontal");     _verticalMovement = Input.GetAxis("Vertical");        }   void FixedUpdate() {     if(_isMovingHorizontal)     {         _rb.velocity = new Vector2( _horizontalMovement * _xSpeed,_rb.velocity.y);     }            _isGrounded = Physics2D.OverlapCircle(_groundPos.position,_checkRadius,_groundLayer);       if(_isGrounded == true)     {         _extraJumps = _extraJumpValue;              }     if(Input.GetKeyDown(KeyCode.Space) && _extraJumps > 0)     {         _rb.velocity = new Vector2(_rb.velocity.x,_jumpForce);         _extraJumps --;              }     else if(Input.GetKeyDown(KeyCode.Space) && _extraJumps == 0 && _isGrounded == true)     {                  _rb.velocity = new Vector2(_rb.velocity.x,_jumpForce);     }       RaycastHit2D hitLadder = Physics2D.Raycast(transform.position,Vector2.up,_distance,_ladderLayer);      if(hitLadder.collider == true)      {         if(Input.GetKey(KeyCode.W))         {             _isClimbing = true;             _rb.gravityScale = 0;         }         else         if(Input.GetKey(KeyCode.Space))          {             _isClimbing = false;                              }            }                     if(_isClimbing == true && hitLadder.collider == true)     {                     _rb.velocity = new Vector2(_rb.velocity.x,_verticalMovement *          _ySpeed);              }     else     {         _rb.gravityScale = 1;     }       } 

add_filter( ‘the_title’ gets through this if statement twice

I am using the accepted answer shown here: Apply the_title() filter in post & page title, but not in menu title

For some reason, the code is getting through this if statement twice:

if ( ! is_admin() && $  post instanceof WP_Post && ( $  post->post_type == 'page' ) && in_the_loop() && is_main_query() ) { 

I am already using the pre_wp_nav_menu and wp_nav_menu_items filters as shown on that answer.

What would be making this code run twice please? Or how would I debug to find out what is calling it and letting it through the if twice?

(When I use debug_backtrace() is shows apply_filters line 212 in plugins.php both times but I’m not sure what to do with that info)

Sorry, I would ask as a follow-up on the posted question, but I evidently can’t comment yet.

Can you chose same spell twice from different sources?

ive got a question. Im optimising my warlock character now and wanted to pick new UA (for now) Hexblood race. I will get a free hex once per long rest as racial trait. Thats awesome for warlock.

And now im looking to a Fey Touched feat. Its says i can pick 1 enchantment spell of my choice. So can i pick another Hex through this feat and cast it without spell slot, so i have 2 free hexes per long rest?

Can you use the Ranger Slayer’s Prey Twice a turn? [duplicate]

From Xanathars:

Slayer’s Prey Starting at 3rd level, you can focus your ire on one foe, increasing the harm you inflict on it. As a bonus action, you designate one creature you can see within 60 feet of you as the target of this feature. The first time each turn that you hit that target with a weapon attack, it takes an extra 1d6 damage from the weapon.

It says you that the first time each turn that you hit THAT target you deal 1d6, so, that being said, can you:

Turn 1: Mark a creature with Slayer Prey Turn 2: Hit the creature with Slayer Prey, gaining the 1d6 bonus damage, design another creature with Slayers Prey and gain the 1d6 bonus damage again?

My thoughts are: You are hiting the secord creature for the first time in this turn, so this should work, right?

Command spell cast twice (PF2e)

Inspired by this question, and by the fact that it almost happened in a recent session.

What happens if a target fails against two different Command spells that give different commands (say, approach and run away)? Since fail specifies the first action, it’s quite ambiguous. I was ready to house rule it stacked (i.e. first action is first command, second action is second command), but that was just a ruling to keep the session going.

Can a 5th level Pact of the blade warlock, use his action to grapple, then attack twice with his pact weapon?

By RAW, when I use a grapple:

"Grappling

When you want to grab a creature or wrestle with it, you can use the Attack action…"

And the 5th level eldrich invocation:

"Thirsting Blade

Prerequisite: 5th level, Pact o f the Blade feature

You can attack with your pact weapon twice, instead of once, whenever you take the Attack action on your turn."

So, by RAW, can the warlock, with those requisites, use his action to grapple and then attack twice with his pact weapon?

Can a Wildshaped Druid trigger Dive Attack twice in a turn?

So I have a lizardfolk moon druid and I was curious about the interaction between his bonus action Hungry Jaws ability and the Dive Attack ability of the Quetzalcoatlus.

"Dive Attack. If the quetzalcoatlus is flying and dives at least 30 feet toward a target and then hits with a bite attack, the attack deals an extra 10 (3d6) damage to the target."

"Hungry Jaws. In battle, you can throw yourself into a vicious feeding frenzy. As a bonus action, you can make a special attack with your bite. If the attack hits, it deals its normal damage, and you gain temporary hit points (minimum of 1) equal to your Constitution modifier, and you can’t use this trait again until you finish a short or long rest."

Now if I Dive Attack I can use my action to bite and receive the Dive Attack bonus damage.

My question is if I also use my bonus action Hungry Jaws to bite does it also benefit from the Dive Attack bonus damage?

Unity 3D – Why does my button need to be clicked twice to work?

My goal is to go back and forth between a series of animations by clicking left and right arrow UI buttons. I wrote this C# script and the "next" button (which executes AddInt() on click) works as intended, however the "previous" button (which calls ReduceInt() on click), needs to be clicked twice to work. Is this a glitch or is something wrong with my code?

public class update_animator_parameter_int : MonoBehaviour {     Animator gameobject_animator;     public string int_parameter;     public int max_int;     public int current_int=0;      void Start(){         gameobject_animator = GetComponent<Animator>();}      public void AddInt(){           current_int++;           if (current_int > max_int){current_int = 0;}           gameobject_animator.SetInteger(int_parameter, current_int);}       public void ReduceInt(){           current_int--;           if (current_int < 0){current_int = max_int;}           gameobject_animator.SetInteger(int_parameter, current_int);} }