The characters in our game are derived from a base class script, which is not attached to any object.
When a level is reloaded or a new level is loaded the character is destroyed, but the base class script remains and when the new character is created at the start of the next level an additional base class script is created.
I know this is happening because the score is incremented in the base class. When the score is increased by 100 in the first level, the score goes up by 100, if the same level is reloaded or the next level is loaded the same 100 point increase results in a 200 point increase. Each reload adds 100 to the score every time it is updated. The object that sends the score update only sends the message once, but there are multiple objects adding 100 to the score (one for each retry or reload)… I’m assuming this is because the Base Class script is being duplicated.
So my question is how can I clean these duplicate scripts from the scene?
I’ve tried Resources.UnloadUnusedAssets(), with no result, also GC.Collect()
I’m stumped…