© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago
Alex

Null object reference when trying to update an instance

I'm trying to code chess but its kinda rough.
https://pastebin.com/YxDs7Wry
https://pastebin.com/AfJQxsi3
https://pastebin.com/BFZVnPN4

If I want to move a piece to a legal square, I try to update the old instance to a new instance by changing the coordinates and assigning the relevant piece art there, but the instances are always null.
Pastebin
Board.cs - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
Pieces.cs - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
Moves.cs - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Object reference set to an instance of an object.
C#CC# / help
3y ago
❔ NullReferenceException Object reference not set to an instance of an object Billboard.Update
C#CC# / help
4y ago
Object reference not set to an instance of an object.
C#CC# / help
2y ago
✅ Object reference not set to an instance of an object?
C#CC# / help
2y ago