C#C
C#3y ago
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
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...
YouTubeSebastian Lague
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) ...
YouTubeSebastian Lague
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...
YouTubeSebastian Lague
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...
Was this page helpful?