Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MonoBehaviour without a GameObject #205

Open
blowfishpro opened this issue Jun 24, 2017 · 3 comments
Open

MonoBehaviour without a GameObject #205

blowfishpro opened this issue Jun 24, 2017 · 3 comments

Comments

@blowfishpro
Copy link
Contributor

Here:

instance = new FARSettingsScenarioModule();

FAR creates a new FARSettingsScenarioModule using the constructor. But ScenarioModule derives from MonoBehaviour, which shouldn't exist unless attached to a GameObject.

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.

@ferram4
Copy link
Owner

ferram4 commented Jun 25, 2017

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.

@blowfishpro
Copy link
Contributor Author

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?

@NathanKell
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants