linuxgurugamer / ToolbarControl

GNU Lesser General Public License v3.0
32 stars 15 forks source link

UnityException: get_dataPath log spam KSP 1.4.5 #2

Closed PiezPiedPy closed 6 years ago

PiezPiedPy commented 6 years ago

While loading, before Main Menu scene, [edit] Found that this is caused by Blizzy Toolbar continued.

[EXC 12:55:49.143] UnityException: get_dataPath is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'ToolbarManager' on game object 'ToolbarManager'.
See "Script Serialization" page in the Unity Manual for further details.
    KSPUtil.get_ApplicationRootPath ()
    Toolbar.ToolbarManager..cctor ()
    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Toolbar.ToolbarManager

While in Flight

[EXC 13:00:54.183] UnityException: get_dataPath is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'ToolbarControl' on game object 'BlizzyOptions'.
See "Script Serialization" page in the Unity Manual for further details.
    KSPUtil.get_ApplicationRootPath ()
    ToolbarControl_NS.ToolbarControl..cctor () (at /var/lib/jenkins/workspace/T-Z/ToolbarControl/ToolbarControl/RegisterUsage.cs:40)
    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for ToolbarControl_NS.ToolbarControl
    ToolbarControl_NS.BlizzyOptions.AddToolbarButton () (at /var/lib/jenkins/workspace/T-Z/ToolbarControl/ToolbarControl/BlizzyOptions.cs:44)
    ToolbarControl_NS.BlizzyOptions.Start () (at /var/lib/jenkins/workspace/T-Z/ToolbarControl/ToolbarControl/BlizzyOptions.cs:35)

Should be an easy fix, I had the same problem with Trajectories and Kerbalism, was just a case of moving a few things out of the constructor and Awake method and putting them in the Start method.

linuxgurugamer commented 6 years ago

Fixed with the latest release, thank you for the PR