Forum begins after the advertisement:
-
::In Part 26, there is an issue with the PlayerCollector
script where, if you don’t have a UICoinDisplay
active in the same scene as the player collector, it will create NullReferenceExceptions that can cause issues with the rest of your project.
The fix is to simply check whether your OnCoinCollected
delegate has any actions attached to it first:
//Updates coins Display and information
public float AddCoins(float amount)
{
coins += amount;
if(onCoinCollected != null) onCoinCollected();
return coins;
}