Jump to content

KSP toolbar bug


Recommended Posts

Sample code designed to show a bug in KSP

Github source here: https://github.com/linuxgurugamer/KSPBugDemo

license: Unlicense

I've opened a report on this on the bugtracker:  http://bugs.kerbalspaceprogram.com/issues/13745


Bug happens in the following case:

1.  Monobehaviour class instantiated with following code:

     [KSPAddon(KSPAddon.Startup.SpaceCentre, true)] // Determines when plugin starts.
    public class KSPBugDemo : MonoBehaviour
{
 private void Start()

        {
            DontDestroyOnLoad(this);
        }

2.  Mod button added, button is NOT supposed to be visible on the main menu:
 

    const ApplicationLauncher.AppScenes scenes =
                ApplicationLauncher.AppScenes.FLIGHT |
                ApplicationLauncher.AppScenes.MAPVIEW |
                ApplicationLauncher.AppScenes.TRACKSTATION;

            _appLauncherButton = applauncher.AddModApplication(
                ToggleWindow, // onTrue
                ToggleWindow, // onFalse
                () => { }, // onHover
                () => { }, // onHoverOut
                () => { }, // onEnable
                () => { }, // onDisable
                scenes, // visibleInScenes
                 GameDatabase.Instance.GetTexture(TexturePath + "spacetux", false) );

Bug is that the button IS visible on the main menu, at least the first time through.

A fix is in the function:
     private void FixedUpdate()

which is disabled in the demo.

My best guess is that the button isn't properly initialized when first created in this case This can be shown by going to any other screen and then returning to the space center, the button will be properly hidden at that point
 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...