Why do I get a NullReferenceException

This is my Error: NullReferenceException: Object reference not set to an instance of an object PlayerJump.OnTouchDown () (at Assets/Scripts/PlayerJump.cs:17) UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions) TouchInput:Update() (at Assets/Scripts/TouchInput.cs:48)

I just can´t fix this error till weeks… I am trying to call a function of an another class “PlayerController”:

'using UnityEngine;
using System.Collections;

public class PlayerJump : MonoBehaviour {

private PlayerController player;

void awake()
    player = gameObject.GetComponentInParent<PlayerController>();

void OnTouchDown()

void OnTouchStay()

void OnTouchUp()


everytime OnTouchDown gets calles the error occurs… just can´t get why? I am doing the same thing from another class and it is working, I would be very thankful if somebody could tell me what´s wrong in this code :slight_smile:

You need to capitalize Awake() function name (case matters). Also, I assume this script is attached to a child object of player controller object.