[modding]Crashes while testing and BuildingIDs

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

ellacharmed

First Lieutenant
14 Badges
Feb 10, 2015
283
29
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Cities: Skylines - Green Cities
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Parklife
  • Surviving Mars: First Colony Edition
  • Cities: Skylines Industries
  • Surviving Mars: First Colony Edition
  • Cities: Skylines - Campus
  • Cities: Skylines Deluxe Edition
I hit a snag when testing my mod - the dialog box changed to the one for cars maintenance and the game crashed. This is after I had saved and reload the game to test if the 2 mods (using same mesh models) can co-exist at next Save load. So when I encountered this issue, I traced back to pinpoint which mod (fish or resource factory) is the faulty one.
Annotation 2020-01-22 103308.jpg


I stripped down the Resource Factory back to bare basics - just the input-output, no recipes, no storage. And was able to reproduce the bug.
So I tested with Fish factory. Save was fine, no crash.

Test methodology:
- with only one mod in, build that building. Save "mod.save" (dialog OK). Quit.
- reload Save (dialog still OK). Build one shelter. Save as "mod-shelter" (dialog OK). Quit.
- reload Save (dialog still OK). Build gate. Save as "mod-shelter-gate" (dialog OK). Quit.
- reload Save. Top bar gets zeroed out. Output log shows crash. Dialog shows as in image.

An excerpt from output_log.txt
Code:
Uploading Crash Report
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Which brings me to take a look at the Building IDs in Unity. Watch video.
Is this the cause of the crash? Or is there something else? Anything I need to correct in my mod or is it a modtool "feature" that needs to be corrected?

@ Devs, if you guys want my Saves, output logs and mods from the above testings, to facilitate your troubleshooting and fixing, let me know...
 

Attachments

  • modtool buildingID.mp4
    3,8 MB · Views: 16
Last edited:

tapani_ifs

Sergeant
Aug 5, 2019
56
1
Mod asset contains a startID, which is chosen by random every time a new mod is created. This will prevent mods from mixing their IDs with default buildings or other mods. For some reason, on your case the script has not executed when the BuildingTemplate has been created and the IDs overlap with the default buildings. This is most likely caused by having compilation errors while creating the BuildingTemplate. I would recommend either modifying the ID by hand to not overlap (ie. pick a big random number) or recreating the BuildingTemplate.