Open blowfishpro opened 7 years ago
I believe this code is necessary though, because I remember putting this in to make sure that training missions and scenarios outside of the main save games work properly. I've never seen any errors or exceptions thrown from it either.
The exception actually occurs here (inside Unity)
but I can't see that happening unless the object isn't created correctly.
Everything I've seen suggests that a MonoBehavior must always be attached to a GameObject. Have you seen something different?
Yeah, generally if you try to do that Unity complains loudly. Certainly if you do that in the editor it does! You should add it to the scenariorunner gameobject probably?
Here:
https://github.com/ferram4/Ferram-Aerospace-Research/blob/d82a3a4282e72a9488ba98045c59b7d2e56fc3d5/FerramAerospaceResearch/FARSettingsScenarioModule.cs#L108
FAR creates a new
FARSettingsScenarioModule
using the constructor. ButScenarioModule
derives fromMonoBehaviour
, which shouldn't exist unless attached to aGameObject
.I think this code is only hit in the incompatible case, which is why it has worked up until now. I also don't think there's any need to manage a
ScenarioModule
's lifecycle manually - KSP should (at least in theory) take care of all that.