The Object you want to instantiate is null

As is normal, I’ve made a typo somewhere. Not enough to get a syntax error, but I get no names in the HUD and I get an null instance error. At least that gives me an idea where to go looking. I probably fat fingered something or gave a different class name than I wanted to give.

Let the hunt begin, again.

Not to bad of a hunt this time. Runtime error got me to this line in Leaderboard.cs:

LeaderboardEntityDisplay leaderboardEntity = Instantiate(leaderboardEntityPrefab, leaderboardEntityHolder);

Turns out I didn’t populate my [SerfializeField] leaderboardEntityPrefab for this script. Now things are working again.

1 Like

Well done for finding it. :slight_smile: Sometimes just writing it out can help our brains work through the problem and find the issue – this is a real debugging technique! (see “rubber duck debugging” :duck:)

1 Like

Along with Rubber Ducking it (yes, I am quite familar with that) I am hoping others will learn from my mistakes as long as they stay near the top.

Need to find error #2. Only the first one in gets on the leader board. And as I suspected, when I kill that guy, he drops off the board as well. Most likely a != where the should be an == (or worse a = where it should be an ==). If only C# would learn from powershell and use -eq instead of ==. I will make less mistakes.

1 Like

Privacy & Terms