Getting NullReferenceException when changing a NetworkList

So I have a NetworkList that is instantiated elsewhere and I’m trying to assign elements via a ServerRPC. In the picture you can see that both the value I’m using to get the element and the element itself is not null. I print them both out in the console, tileIndex is 0, and dungeonMaker.OccupiedTiles[tileIndex] is false. Yet when I try to change the value I get a NullRefException.

You’re using a very old version of NGO, to rule out this is a bug that’s been fixed update to the latest version (1.10.0).

Just noticed you’re using Unity 2020, in that case I think the last version of NGO that’s compatible is 1.7.1

I’m still getting the same error. I had to upgrade my unity version to use 1.7.1 and so I just update to the latest version of both.

Strange, I use 1.7.1 in Unity 2020, it’s the final version though.

I’m not sure on the error, it could be a bug. Can you post the code for DungeonMaker, is it an in-scene object? I’ll see if I can reproduce it later.

I did you something better. I made a new project, reproduced it, and uploaded it on my google drive.

https://drive.google.com/drive/folders/1efgoWzlaCasxnGxb_YAzb97JAMsmTokE?usp=sharing

Thanks. Moving the SpawnPlayerRpc() call into Start rather than calling in OnNetworkSpawn with fix this. I don’t know exactly why but I’m a bit wary of referencing another network object before Start.

Well, that’s stupid haha. Thanks for the help though!

1 Like

Tiles? How big will your map be?

Because if you try to synchronize anything bigger than say a 64x64 tilemap you’ll quickly run into issues where you’re sending too much data all at once. 64x64 list with an int is 16 KiB. The limit per tick is between 32 to 64 KiB.