Unity C# NullReferenceException : <p>I know, this question was already answered a lot here, and believe me, I've tried so many ways to fix that problem, but it occurs over and over again.</p>

<p>So basically, I'm trying to change e.g. money in my game, from a different script.</p>

<p>But as soon as I click the button, I get this error message. I think I'm doing anything fundamentally wrong here, but it also happens in my score script, but that is still working anyhow... But here is the error: </p>

<pre><code>NullReferenceException: Object reference not set to an instance of an object
Score.ResetScore () (at Assets/Scripts/Score.cs:36)
</code></pre>

<p>And here are the Scripts that <strong>should</strong> work together.</p>

<p>Script 1: </p>

<pre><code>void ResetScore()
    {
        GameManager gamemanag = GetComponent&lt;GameManager&gt;();
        score = 0;
        gamemanag.ResetQuestions();
    }
</code></pre>

<p>Script 2:</p>

<pre><code>public void ResetQuestions()
    {
        unansweredQuestions = questions.ToList&lt;Question&gt;();
    }
</code></pre>

<p>That was the score script because it's a bit cleaner. This doesn't really work as it should as well and I have no Idea why...</p>

<p>I'm posting the full code on pastebin at the end.</p>

<p>Would be great if you could help!</p>

<p>Script 1: <a href="http://pastebin.com/raw/qvbFYd3x" rel="nofollow noreferrer">http://pastebin.com/raw/qvbFYd3x</a></p>

<p>Script 2: <a href="http://pastebin.com/raw/8gMzaagq" rel="nofollow noreferrer">http://pastebin.com/raw/8gMzaagq</a></p>
