Hey guys. I’m currently trying to add a walljump to my little test game. I simply want to check if a character jumps next to a wall and presses jump again in mid air, and have them boost away from the wall.
I’ve got the raycasting done, located in the Raycast script file, and it sends a variable specifying left or right boosting based on where the wall is to the jumpCheck script.
The problem I get is something I am not sure about, so I need some help. This is my current script for jumpCheck:
var sideHitting : int;
sideHitting = 0;
function Update () {
if (gameObject.GetComponent(CharacterMotor).CharacterMotorJumping.holdingJumpButton == false gameObject.GetComponent(CharacterMotor).CharacterMotorJumping.jumping == true sideHitting == 0){
if (Input.GetKeyDown(KeyCode.Space)){
if(sideHitting == 1){
Debug.Log("LEFT");
//Boost Left
sideHitting = 0;
}
if(sideHitting == 2){
Debug.Log("RIGHT");
//Boost Right
sideHitting = 0;
}
}
}
}
For this I am returned an error that says: “NullReferenceException: Object reference not set to an instance of an object” along with a lot of other jargon. It ends, “checkJump.Update () (at Assets/Script/checkJump.js:6)”.
I’m assuming I am not referencing the CharacterMotor properly or something like that. But I am still very new to this so I am not sure of the correct way.
If anyone can help me out I would be most grateful.
Thanks!