Visual Scripting Errors

Cheyne Stahlhut shared this bug 13 months ago
Solved

Hi guys,

Looks like the last update completely broke all visual scripts. Get this error upon loading even a blank script that does nothing.

MOD PARTIALLY SKIPPED, LOADED ONLY 1/6 PHASES, Following Error occured:

Object reference not set to an instance of an object.

Sandbox.Game

at Sandbox.Definitions.MyDefinitionManager.LoadDefinitions(List`1 contexts, List`1 definitionSets, Boolean failOnDebug, Boolean isPreload)

Comments (4)

photo
1

After further testing doesn't appear to be affecting all scripts.

This VS mod though still causes the error: -

https://steamcommunity.com/sharedfiles/filedetails/?id=1431620589

So does a blank script with just the 4 nodes in it.

photo
2

Managed to track down why one works and the other doesn't.

Looks like the error happens if the mod doesn't have a 'Data' folder. Simple creation of the folder makes everything work fine even if the scripts arent in it and its completely empty *shrugs*

photo
1

So discovered it worked fine locally only to find workshop version didn't. I have to actually include cubeblocks.sbc, handitems.sbc etc etc. So yep, relative pathing must be broken again.

photo
2

I played around with this issue in dnSpy and found that the error occurs because one of the sub-lists is null and it can't be foreach'd.


unknown


Simply adding a nullcheck for `list[k]` before that foreach will prevent these errors and whatever hidden damage they might do to other mods.