© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
29 replies
rotkip

❔ MissingReferenceException: ... in Unity

This is the exception that occured: NullReferenceException: Object reference not set to an instance of an object
Highscores.AddNewHighscore (System.String username, System.Int32 score) (at Assets/Scripts/Highscores.cs:22)

I followed some tutorials for creating a game with a menu, online stored leaderboard and a game over UI. Here are the tutorials (they are a bit outdated): game ep 1) https://youtu.be/OspvMh3UWPU,
game ep 2) https://youtu.be/5vov9H7RuF8,
game ep 3) https://youtu.be/beWwwxn7dLQ,
game ep 4) https://youtu.be/6nfaPDPA-Y8,
leaderboard ep 1) https://youtu.be/KZuqEyxYZCc,
leaderboard ep 2) https://youtu.be/9jejKPPKomg,
menu) https://youtu.be/-GWjA6dixV4

Here is my code, I don't think that I follow any of the code conventions.
https://paste.pythondiscord.com/zetovelida

The game is about dodging falling blocks as long as you can, I added a highscore system and a menu.
Schermafbeelding_2023-07-03_om_21.13.50.png
Schermafbeelding_2023-07-03_om_21.14.01.png
Schermafbeelding_2023-07-03_om_21.14.19.png
YouTubeSebastian Lague
Introduction to Game Development (E13: falling blocks game 1/4)
Welcome to episode thirteen of this introduction to game development in Unity with C#.

In this episode we look at player movement for a simple 'avoid the falling blocks' game.

Project files:
https://github.com/SebLague/Intro-to-Gamedev

If you'd like to support these videos, you can make a recurring monthly donation (cancellable at any time) t...
Introduction to Game Development (E13: falling blocks game 1/4)
YouTubeSebastian Lague
Introduction to Game Development (E14: falling blocks game 2/4)
Welcome to episode fourteen of this introduction to game development in Unity with C#.

In this episode we instantiate the falling blocks and randomize their rotation and scale.

Project files:
https://github.com/SebLague/Intro-to-Gamedev

If you'd like to support these videos, you can make a recurring monthly donation (cancellable at any time) ...
Introduction to Game Development (E14: falling blocks game 2/4)
YouTubeSebastian Lague
Introduction to Game Development (E15: falling blocks game 3/4)
Welcome to episode fifteen of this introduction to game development in Unity with C#.

In this episode we create a player death condition, and increase the difficulty of the game over time.

Project files:
https://github.com/SebLague/Intro-to-Gamedev

If you'd like to support these videos, you can make a recurring monthly donation (cancellable a...
Introduction to Game Development (E15: falling blocks game 3/4)
YouTubeSebastian Lague
Introduction to Game Development (E16: falling blocks game 4/4)
Welcome to episode sixteen of this introduction to game development in Unity with C#.

In this episode we create a game over screen and export the game as a standalone build.

Project files:
https://github.com/SebLague/Intro-to-Gamedev

If you'd like to support these videos, you can make a recurring monthly donation (cancellable at any time) thr...
Introduction to Game Development (E16: falling blocks game 4/4)
YouTubeSebastian Lague
[Unity Tutorial] Online Highscores 01 (dreamlo)
Learn how to create an online leaderboard system in Unity using http://dreamlo.com
Source code: https://github.com/SebLague/Dreamlo-Highscores

Watch part two: https://www.youtube.com/watch?v=9jejKPPKomg
Dreamlo website: http://dreamlo.com
[Unity Tutorial] Online Highscores 01 (dreamlo)
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ Unity property unityaction invoke
C#CC# / help
3y ago
Jump in Unity
C#CC# / help
3y ago
NullReferenceException in unity
C#CC# / help
3y ago
❔ ✅ Serializable attribute in Unity
C#CC# / help
3y ago