Triggering Super Jump Ability

Hi, I’m trying to create a trigger to enhance the players jump height for a single jump.

I’d like to engage the jump ability with one trigger, then immediately remove the ability again with a second trigger.

I have a variable in my script:
public float jumpVelocity = 12;

I have a basic trigger script, but don’t know how to access the variable with it. Is there a way I can access it and bump this number up (to 70)?


Of course you can do it that way.

say your script SuperJump:

public float jumpVelocity = 12;

some other script

you could do…
’ SuperJump superJumpScript = GetComponnent();`
change the jumpVelocity as such

superJumpScript.jumpVelocity = 70

of course access values like this is safe, and some practices prefer getters and setters or using functions, etc, but I am leaving that up to you. I am just showing how to reference your script.

I suggest viewing Unity’s tutorials modules on their website as they teach you these basic scripting features. Another good site for beginner is

edit you can also access the variable directly

superJump = GetComponent().jumpVelocity;

changing superJump should change the value you have in your SuperJump script, but this practice I don’t like personally. Just view tutorials for more in depth reasons.

What exactly are you trying to do? Is it like a plate that you will trigger and will propulse you up are is it with a button you re trying to achieve this?

i would have a Boolean value

bool superJumpActive = false;

then when you hit the trigger, or the power bar fills up or whatever.

superJumpActive = true;

in your jump script

jumpVelocity = 70;
superJumpActive = false;