joaofarias / csl-traffic

A WIP mod for Cities: Skylines to improve traffic.
91 stars 30 forks source link

Possible issue resetting AIs on multiple game load/unload? #62

Open originalfoo opened 9 years ago

originalfoo commented 9 years ago

Source: https://forum.paradoxplaza.com/forum/index.php?threads/no-import.862018/

Log: https://gist.github.com/anonymous/4e90f3c84c2737c4be6e

joaofarias commented 9 years ago

There might be an issue with the AIs on multiple load/unload but I don't think that's his problem because it would have worked fine on the first load. :/

originalfoo commented 9 years ago

Perhaps not directly related to this ticket but someone just posted this finding on the Mesh Info mod page:

CWMlolzlz 21 hours ago Hey SamsamTS. Ive been developing a mod and have been using your code as a reference to get things started. I found that when quickloading (using F4) the old UIPanels aren't being properly disposed. Pressing Ctrl+M will toggle the visibility of all of them. After investigating other mods i have found they use GameObject.Destroy(m_panel.gameObject); to dispose of the panels. As far as I can tell that one line can replace

m_mainPanel.parent.RemoveUIComponent(m_mainPanel);
GameObject.Destroy(m_mainPanel);
in both your OnReleased() and OnLevelUnloaded() methods