Jump to content

[1.2.0] Toolbar 1.7.13 - Common API for draggable/resizable buttons toolbar


blizzy78

Recommended Posts

Hello, after installing the toolbar i get this message in the Debug Toolbar when im launching a rocket: [Exception]: NullReferenceException

And when im returning to my vessel from the tracking station i get this: KeyNotFoundException: The given key was not present in the dictionary.

Is this bad?

Link to comment
Share on other sites

Hello, after installing the toolbar i get this message in the Debug Toolbar when im launching a rocket: [Exception]: NullReferenceException

And when im returning to my vessel from the tracking station i get this: KeyNotFoundException: The given key was not present in the dictionary.

Need more information. Please find those exceptions in your output_log.txt, which has way more information, then post them with the complete stack trace here.

As to if they're "bad": Even if they're caused by the Toolbar Plugin, they could be harmless. It's not easy to tell with too few information.

Link to comment
Share on other sites

NullReferenceException

at (wrapper managed-to-native) UnityEngine.Component:InternalGetTransform ()

at UnityEngine.Component.get_transform () [0x00000] in <filename unknown>:0

at SpaceCenterCamera2.UpdateTransformOverview () [0x00000] in <filename unknown>:0

at SpaceCenterCamera2.UpdateTransform () [0x00000] in <filename unknown>:0

at SpaceCenterCamera2.Update () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

__________________________________________________________________________________________________

KeyNotFoundException: The given key was not present in the dictionary.

at System.Collections.Generic.Dictionary`2[Vessel,MapObject].get_Item (.Vessel key) [0x00000] in <filename unknown>:0

at SpaceTracking.OnDestroy () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

Do you need more information?

Link to comment
Share on other sites

Ok, thanks anyway.

It might be helpful if you include all the mods you have installed, or even better your entire output_log.txt. But if you did fully remove toolbar, it is probably caused by some other mod.

Link to comment
Share on other sites

It was a fresh install with no other mods than toolbar. In the meantime i tested with other mods too (every mod seperate) and some where causing the NullReferenceException and some not. But i always got the key KeyNotFoundException.

I now think that the KeyNotFoundException is caused by KSP itself (I've tested without mods). It does not always appear but most of the time, thats why i first thought it was caused by toolbar.

Now i tested again with toolbar and i dont get the NullReferenceException anymore but still the KeyNotFoundException. I dont know why.

So i dont think toolbar is causing those messages.

Link to comment
Share on other sites

I'm trying to integrate Toolbar into my mod without a hard dependency (using the Toolbar Wrapper) but keep running into an error. It works great when I build against the .dll by the way, so thank you for that! I've changed the namespace to that of my mod and it compiles just fine, but whenever I try to actually load the game I keep getting this error:

Non platform assembly: C:\Program Files (x86)\Steam\SteamApps\common\Kerbal Space Program\GameData\KerbalConstructionTime\Kerbal_Construction_Time.dll (this message is harmless)
AssemblyLoader: Exception loading 'Kerbal_Construction_Time': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0

Additional information about this exception:

System.TypeLoadException: Could not load type 'Kerbal_Construction_Time.ToolbarManager' from assembly 'Kerbal_Construction_Time, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

System.TypeLoadException: Could not load type 'Kerbal_Construction_Time.GameScenesVisibility' from assembly 'Kerbal_Construction_Time, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

(Filename: C:/BuildAgent/work/ea95e74f6e5f192d/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)

I'm sure it's something that I'm doing wrong, but I can't seem to figure it out.

I've also got this in my main file to add the button:

internal Kerbal_Construction_Time()
{
if (ToolbarManager.ToolbarAvailable)
{
Debug.Log("[KCT] Adding Toolbar Button");
KCT_GameStates.kctToolbarButton = ToolbarManager.Instance.add("Kerbal_Construction_Time", "MainButton");
KCT_GameStates.kctToolbarButton.TexturePath = KCT_Utilities.GetButtonTexture();
KCT_GameStates.kctToolbarButton.ToolTip = "Kerbal Construction Time";
KCT_GameStates.kctToolbarButton.OnClick += ((e) =>
{
KCT_GUI.onClick();
});
}
}

public void OnDestroy()
{
if (KCT_GameStates.kctToolbarButton != null)
{
KCT_GameStates.kctToolbarButton.Destroy();
}
}

and in KCT_GameStates I have "public static IButton kctToolbarButton;"

Thanks for your help! Let me know if I need to provide anything else.

Link to comment
Share on other sites

Why does all toolbar buttons default to hidden anyway? It's confusing and annoying to have to add each new mod's icon to the bar, they should be visible by default, most people will want to see them all or hide specific ones they don't want, not only show a few.

Link to comment
Share on other sites

Given the number of buttons that some mods have (I'm looking at yooooou, MechJeb), the default of hiding all buttons may be better than revealing all.

However, an even better idea might be to show all buttons but to have a Hide All facility.

Link to comment
Share on other sites

MJ has no buttons by default except the MJ menu one, you need to hit the small t on the window to add them as far as I know.

I just put all of them in a folder with the MJ icon as the folder icon.

Link to comment
Share on other sites

MJ has no buttons by default except the MJ menu one, you need to hit the small t on the window to add them as far as I know.

I have advised Sarbian to get rid of the little T because players can now choose themselves which buttons they want to see.

Link to comment
Share on other sites

What do you think about my suggestion to make buttons visible by default instead of hidden? I find it annoying, every time I install a mod that uses the toolbar I need to remember to show it's button to use it, just feels like it's less work hiding what you don't want than showing everything you want, seems a bit backwards currently.

Link to comment
Share on other sites

Works fine for me.

Apologies... more investigation revealed subtle difference in behaviour. IIRC, previous versions said hello and created the toolbar.dat all by themselves, this one does nothing unless and until another plugin requests it. i.e. if the only present plugins are built with it as an option rather than a hard dependency, until they are configured to use it, it does not create the file or show itself. :)

Link to comment
Share on other sites

I have a problem - Toolbar seems to have 2 instances running.

https://www.dropbox.com/s/xc46vjp9btdrnul/Screenshot%202014-03-15%2022.24.37.png

I have tried searching my Game Data folder - there is just one toolbar.dll, and just one 000_Toolbar folder(aside from the secondary 000_Toolbar) in BoulderCo.

That's because you must've created another one somewhen. A couple if updates ago, blizzy made so you can have multiple ones. See the delete toolbar option in the dropdown? Click that.

Link to comment
Share on other sites

That's because you must've created another one somewhen. A couple if updates ago, blizzy made so you can have multiple ones. See the delete toolbar option in the dropdown? Click that.

Yes, this. In your screenshot, the "Delete Toolbar" option is enabled. It will only ever be enabled if there is more than one toolbar (so that you cannot delete the last one.)

Link to comment
Share on other sites

  • 3 weeks later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...