Object reference not set to an instance of an object
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:
Open the log file in notepad or some other Text Editors
Search for
Object reference not set
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
:Caused by game-breaking Improved Asset Icons or Improved Asset Icons (alternative) mod - completely unsubscribe it/them.
Related error: FormatException Invalid Image Format
A good alternative is the reliable Find It mod.
Building.PlayAudio
, orBuilding.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
, orToolBase.OnEnable
, orBuildingAI.CheckUnlocking
, orRealTime.Simulation.Statistics
...:Usually caused by the Ploppable RICO mod or building assets that have Ploppable RICO definitions.
See: Ploppable RICO errors for how to fix
Make sure you don't have game-breaking Building Anarchy mod as that can cause similar errors.
IINS.PROPFINETUNING.PropFineTuner.Done
:Unsubscribe Prop Fine Tune
You could use keyboard shortcuts in Move It! mod options to get similar functionality ;)
MaZy.AutobulldozeMod
:Unsubscribe Automatic Bulldoze Simple Edition
A better alternative is Bulldoze It!
RoadBaseAI.CanEnableTrafficLights
:This error happens when your save (or a building you have subscribed) contains a road, rail or other transport asset that is not available
Sometimes triggers side effects, e.g.
Building.PlayAudio
orBuilding.CalculateGroupData
errors
Can often be fixed with Safenets mod
See also How to Remove Workshop Networks
More info and fixes: Simulation error Object reference not set
WaterSimulation.ReleaseWaterWave
:Possibly caused by Ragnarök, 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 (e.g. 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'sskip.txt
file. Solution: Don't skipGarbage Bin
.
NetTool.TestNodeBuilding
:Possibly a network mod by Elektrix?
RadioPanel.AssignStationToButton
, orTreeInstance.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 limits.
If More Vehicles mod is later disabled or removed, the save will break
To fix: Re-enable More Vehicles mod.
Ploppable 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:
Exit game to desktop
Subscribe and enable Loading Screen Mod (LSM)
In its mod options:
Enable the optimization/sharing options to reduce RAM use (will make games load faster)
Enable the safe mode options
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 :)
Was it Fixed?
If not:
If you think it's TM:PE that causes the error, please let us know: Report a Bug (we're crazy busy, so it may take a while for us to investigate)
You could check for broken assets - see: Finding Broken and Bloated Assets
Seek help in Steam discussion forums or Cities Skylines Discord Server. Remember to share your log file!
Other issues? See: 👉 Troubleshooting