Skip to content

Object reference not set to an instance of an object

Aubergine edited this page Apr 21, 2020 · 50 revisions

Verified: April 2020

Note: Loading Screen Mod "Safe Mode" options can sometimes recover from the error - see bottom of this page for details.

Symptoms

You see an error on-screen like the following:

  • Object reference not set to an instance of an object [System.NullReferenceException]

Or, you might see either on-screen or in your log file an error like:

  • Simulation error: Object reference not set to an instance of an object

Or:

  • NullReferenceException: Object reference not set to an instance of an object

Cause

Currently, TM:PE is not reported to cause this error.

This is caused when a mod tries to access a game object (usually) that no longer exists. It's very common error, but we'll try and document some solutions to known causes below...

Solutions

First:

What we're interested in is the stuff that appears on the next few lines after the error message. That stuff will usually be several lines starting with at. Look for any of the following strings in that text:

  • AssetIcons.IconModifier.PatchIcons:
  • Building.PlayAudio, or
  • Building.CalculateGroupData:
    • Caused by game-breaking Control Building Level Up 0.4 mod - completely unsubscribe the mod
    • Check if there is a RoadBaseAI.CanEnableTrafficLights error in your log file; if so the Safenets mod might fix both errors.
  • PloppableRICO, or
  • ToolBase.OnEnable, or
  • BuildingAI.CheckUnlocking, or
  • RealTime.Simulation.Statistics...:
  • IINS.PROPFINETUNING.PropFineTuner.Done:
    • Unsubscribe Prop Fine Tune
    • You could use keyboard shortcuts in Move It! mod options to get similar functionality ;)
  • MaZy.AutobulldozeMod:
  • RoadBaseAI.CanEnableTrafficLights:
  • WaterSimulation.ReleaseWaterWave:
    • Possibly caused by Ragnarok, Natural Disasters Overhaul or some other mod that alters natural disasters (particularly the tsunami "tidal wave").
    • Solution: Launch a meteorite in to the water where the Tsunami was happening. This has to be the best bug fix ever found. Thanks to steam user Darky for the tip!
  • Rainfall.Hydraulics.updateDistrictAndDrainageGroup:
    • Caused by Rainfall mod, most likely due to missing required assets.
    • Could be due to conflicts between Rainfall and other mods (namely any that affect water, weather or disasters).
  • ColossalFramework.UI.UIComponent.RebuildComponentOrder:
    • If the stack trace in log mentions at NetPicker, it's the Net Picker mod
  • VehicleEffects.VehicleEffectsMod:
    • If the error mentions OnLevelUnloading some other mod broke the loading process; not vehicle effects.
    • Otherwise, it's issue with Vehicle Effects or Extra Vehicle Effects mod(s) trying to apply effects to a vehicle that does not exist. Solution: Remove any unnecessary effects mods (eg. train sound effects or whatever) or find and resubscribe the missing asset. For vanilla or DLC vehicles, check they aren't in skip.txt of Loading Screen Mod.
  • VanillaGarbageBinBlocker.PropManagerDataPatch.Prefix:
    • This error occurs if you have Garbage Bin Controller mod, but you skipped the Garbage Bin prefab with Loading Screen Mod's skip.txt file. Solution: Don't skip Garbage Bin.
  • NetTool.TestNodeBuilding:
    • Possibly a network mod by Elektrix?
  • RadioPanel.AssignStationToButton, or
  • TreeInstance.PopulateGroupData:
    • Seems to be caused by Nursing Homes for Senior Citizens mod
  • VehicleManager.SimulationStepImpl:
    • The save game was created with More Vehicles mod active, which increase vehicle limts.
    • If More Vehicles mod is later disabled or removed, the save will break
    • To fix: Re-enable More Vehicles mod.

There are reports that Service Vehicles Manager also causes object reference errors, although we haven't seen a log file to confirm.

Ploppabe RICO

I've moved this to its own guide: Ploppable RICO errors

Loading Screen Mod: Safe Mode

Sometimes the errors can be fixed using the "Safe Mode" options in Loading Screen Mod:

  1. Exit game to desktop
  2. Subscribe and enable Loading Screen Mod (LSM)
  3. In it's mod options:
    • Enable the optimisation/sharing options to reduce RAM use (will make games load faster)
    • Enable the safe mode options
  4. Now load your save - LSM will do everything it can to beat those errors

Sometimes it just won't solve the problem, or it will only save it once but then the error comes back on subsequent loads. If that's the case, it's almost certainly a broken asset, missing asset or broken mod.

Old causes of error

All these should now be fixed, but just keeping here for reference:

  • TransportStationAI.IsIntercity:
    • Bug in vanilla game due to Sunset Harbor update FIXED in 1.13.0-f8!
    • Old buildings, that were created before "sub buildings" feature was added to game (mostly those made before 29th November 2016) have a null value for their sub buildings property.
    • You can fix all those buildings with the IsIntercity Fix mod :)

Fixed?

If not:

Other issues? See: Troubleshooting

Clone this wiki locally