Jump to content

[1.0.x] [V1.9f] Kerbal Foundries wheels, anti-grav repulsors and tracks


lo-fi

What to work on next?  

1,282 members have voted

  1. 1. What to work on next?

    • More wheels
      123
    • More tracks
      453
    • Rover bodies
      241
    • Landing gear
      137
    • Landing legs
      108
    • Something completely different
      193


Recommended Posts

I completely agree, and honestly I never would have known about it had you not featured it in several of your pictures. It's a shame so many good mods get lost in the fog

As far as I'm aware, it really just needs a functional (RPM enabled, and transparent pod enabled, I hope) IVA attached to it. In the future I'd love to see the work you did on the engines, lo-fi, be expanded into allowing the engines to work together to emulate gimbal action by adjusting the positions of the extended engines relative to the craft upon input to the gimbal system. But, that's for another time. Something that would be amazingly cool for the future would be some sort of rover body that would fit inline with the rest of the tug parts.

I remember, as a workaround for the IVA, some people started clipping the IVA from the command pod in the... (forgetting the name of it, that little 1-seater command pod with the transparent pod enabled spherical view) ... anyway, putting that IVA into the tug, which worked relatively well if you ignore the fact that the internal side of the transparent spherical view port didn't really fit the tug pod very well. If one were to strip out the badly fitting parts of that IVA though, and stick it in there, it would probably work rather well.

I jsut with the author would come back. He had some pretty crazy ideas for making customization of the parts more and more unique. That tug pod, for example, can take both a window texture swap, a semitransparent window decoration texture swap that can take standard flags from the stock game or mods as input, and several texture swaps for pod color and warning-tape style decorations.

Link to comment
Share on other sites

As far as I'm aware, it really just needs a functional (RPM enabled, and transparent pod enabled, I hope) IVA attached to it. In the future I'd love to see the work you did on the engines, lo-fi, be expanded into allowing the engines to work together to emulate gimbal action by adjusting the positions of the extended engines relative to the craft upon input to the gimbal system. But, that's for another time. Something that would be amazingly cool for the future would be some sort of rover body that would fit inline with the rest of the tug parts.

I remember, as a workaround for the IVA, some people started clipping the IVA from the command pod in the... (forgetting the name of it, that little 1-seater command pod with the transparent pod enabled spherical view) ... anyway, putting that IVA into the tug, which worked relatively well if you ignore the fact that the internal side of the transparent spherical view port didn't really fit the tug pod very well. If one were to strip out the badly fitting parts of that IVA though, and stick it in there, it would probably work rather well.

I jsut with the author would come back. He had some pretty crazy ideas for making customization of the parts more and more unique. That tug pod, for example, can take both a window texture swap, a semitransparent window decoration texture swap that can take standard flags from the stock game or mods as input, and several texture swaps for pod color and warning-tape style decorations.

Yup that single seat pod is from transparent command pods. And that's what I used. I turned the existing unfinished IVA into a prop, scaled it slightly and applied a texture. Then used a combination of the two IVA's. It was my first attempt so be gentle. The RPM props will be out of date with the new updates but at least its a start and it looks finished without the fish bowl transparency around you.

Link to comment
Share on other sites

Hey I actually did this for my self. Added two rpm MFDs as well as the interior from another one of his pods, and changed the texture inside to carbon fiber. It could use some..... ok a lot of polishing but it might give you a head start? Let me know if you get permission. Other wise I can just PM it to you if you're interested.

Totally didn't see this post before making my own post about it. I look forward to seeing that.

It's unfortunate, but we're going to get more and more reports of the part icons being messed up as more people start using this mod, despite any OP warnings. I expect any days now we'll get two reports in the same page too, cause people don't tend to read backwards much. I'm guilty of that as much as anyone.

I wonder if fixing the issue with the size report will also fix the problem with the part icon...

Edited by Gaalidas
Link to comment
Share on other sites

I'm surprised we don't get more than we do, given the number of downloads...

The two problems are definitely caused by the same thing, but the fix is going to be different. You'll notice that the craft icons for saved ships in the editor are also messed up. Would be ideal if the bounds detection were fixed properly really!

Link to comment
Share on other sites

Well, that's doubtful to be fixed officially anytime soon. You'll notice that the icon problem seems to mostly affect KF tracks, with maybe a few outliers in other mods here and there, but it's a very rare occurrence. In fact, the only log entries I get from the icon fixer mod are related to KF. With the move to Unity 5, perhaps there's something new in there that could be useful here, but that also comes with a change to how wheels work at the core which could provide its own issues to tracks and such.

Anyway, looks like the part icon fixer is still needed then.

Link to comment
Share on other sites

Yep, it's here to stay for the moment. The drag cubes possibly need doing too, just depends how they're calculated.

I'd be surprised if there were as many as give mods using skinned meshes, so it's certainly niche. I believe someone piped up in the icon fixer thread about some solar panels, but that's the only other I know of did certain.

I'd like to do some HD versions of certain parts some time, just for giggles. So proper moving, compressing springs, flexible pipes, rubber bellows around joints, that sort of thing. All will need skinned meshes. The kind of thing that would be cool in a cinematic :)

Edited by lo-fi
Link to comment
Share on other sites

Indeed, that would be awesome. Wouldn't be too usable in daily Kerbal-killing.... errr.... scientific adventures.... though.

Hey, another thing I thought of: fixing up the cargo hold of the rover body to properly shield interior parts might be something to look into in the future. I mean, the likelihood that someone will re-enter with the rover body as the main hull is slim, but you never know.

Edited by Gaalidas
Link to comment
Share on other sites

You mean the stock nodes? There was some change done to that system a while back, though I don't see it affecting the wheels and such so I don't know how or why. I do know that there were some orientation values that had to be flipped from positive to negative after KSP 1.0 released for them to function correctly, but I haven't read any documentation about that change.

On that note, someone finally revamped parts of NodeHelper and got it released for the current game version, which means I'll be able to go in and visually diagnose node errors. It probably still suffers from the inaccuracies between the numbers and how the part actually gets loaded, but I think I figured out how to do a little math and get around that problem by finding the difference between the original and new numbers from NodeHelper and then applying that difference to the original numbers from the config. I don't know why, but NodeHelper does not report back the proper node locations when it accesses that data from the part itself, and if you use the numbers in the output from NodeHelper, upon reloading the game the nodes will be really whacky.

In other news... I'm having a real problem with the GUI again. I added a button to the bottom, again using another mod as a template. I've checked and rechecked that no separate definitions or "using" statements are different between the files, and copied the original code that simply checked the state of a button and executed a command when it was pressed. i added that in to our GUI and set it's text to "Save and Close" and then, when the "if" statement found that button to be in a "true" state (which is returned when it is pressed) it then sets the variable "isGUIEnabled" to false, which should cause the next check that the game does to OnGUI() to hide the GUI, and then makes a call to "KFPersistenceManager.SaveConfig()" in the exact same manner than the "onFalse" method does it.

I then added a debug log entry to that "if" statement to make sure that the stuff inside it was actually being called properly. In-game I get no debug log entry, no configs saved, and no closure of the GUI. All I get is a Nullref error in my log. I re-checked my template mod, which I have tested to make sure it works, and it does. So, I have no idea what is wrong with my implementation of it. There's literally no difference other than the names of the methods to match the mod except that in the template mod the config saving method is held within the same class. Considering it seems to not even be activating the button properly, I don't see how the stuff I'm telling it to call have anything to do with it since it's not calling them.

Why must everything be so screwed up all the time?

Edited by Gaalidas
Link to comment
Share on other sites

I then added a debug log entry to that "if" statement to make sure that the stuff inside it was actually being called properly. In-game I get no debug log entry, no configs saved, and no closure of the GUI. All I get is a Nullref error in my log.

And where does the stack trace from that Nullref lead you?

Link to comment
Share on other sites

If I knew that, I might be able to fix it, eh? It's very vague.

From the log:

[EXC 12:38:27.261] NullReferenceException: Object reference not set to an instance of an object
KerbalFoundries.KFGUIManager.DrawWindow (Int32 windowID)
UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style)

From the output_log:

NullReferenceException: Object reference not set to an instance of an object
at KerbalFoundries.KFGUIManager.DrawWindow (Int32 windowID) [0x00000] in <filename unknown>:0

at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0

(Filename: Line: -1)

These entries tell me absolutely nothing! all it's saying is that there's a problem, but the code is EXACTLY like that of another mod which works PERFECTLY in relation to the button. I need MORE than just a message saying "it's borked, do it right next time!" if I'm going to make anything work. I'm not trying to freehand code this thing, I copied and pasted it from a functioning mod with absolutely no extra defines or using directives that would be needed for a simple button to work! I'm not jsut spouting off after a single attempt either. This is at least two days of trying various thigns over and over and over and over. This is completely and utterly stupid!

Link to comment
Share on other sites

It does tell you quite a lot. No reason to see if onFalse is getting called, stack trace shows it isn't. If your code is the same as on github, then appButton is clearly null for some reason. No problem with the GUI code, then. Your new job is to figure out why appButton is null, assuming you're testing in the flight, space center or editor scene. If not, it should be fairly simple to see why you're getting a nullref

Where are the art assets kept?

Edited by xEvilReeperx
Link to comment
Share on other sites

Yeah, I'm not sure how to do that. For some reason all the attach nodes are in the wrong place now too.
You mean the stock nodes? There was some change done to that system a while back, though I don't see it affecting the wheels and such so I don't know how or why. I do know that there were some orientation values that had to be flipped from positive to negative after KSP 1.0 released for them to function correctly, but I haven't read any documentation about that change.

Yup Gaalidas is right, the node definitions became more "strict" So Top is regular and the bottom node needs to be inverted. And looking over the cfg for the rover body, your nodes are defined in the .mu file correct? So before you would have

node_stack_top = 0.00, 0.4, 1.98, 0.00, 0.00, 1.00, 1

node_stack_bottom = 0.00, 0.4, -1.6, 0.00, 0.00, -1.00, 1

and now you would have

node_stack_top = 0.00, 0.4, 1.98, 0.00, 0.00, 1.00, 1

node_stack_bottom = 0.00, 0.4, -1.6, -0.00, 0.00, -1.00, 1

But because you defined them in the .mu file I honestly don't know how to fix that.

Link to comment
Share on other sites

If appButton were null, then I wouldn't get a button on the toolbar, nor would I ever even get a GUI in the first place. Nowhere in those messages in the log does it say that appButton is false, besides the state of appButton does not define whether or not the GUI element inside the GUI window is an instance of an object or not! all appButton does is define what the button is for the toolbar. At this point, our absolutely not null appButton has already put a button on the toolbar and the GUI has been called. Can a null object do that? I think not.

If I were testing this outside of the scenes that allow for the GUI to exist, then I would be doing something that is completely and utterly impossible. The button only spawns on the toolbar if we are in a scene that is specified in the button's defined visible scenes. it is destroyed when the toolbar destroys itself (between scenes and whatnot). However, to answer the question, I am launching the game, going to my saved game which takes me to the space center, clicking the button for the KF GUI to open, then clicking my button inside the GUI to "Save and Close" and that is all.

Art assets are all in the other repository where our source used to be. We have a folder named Assets in there, and everything is in there. It shouldn't matter for this button though, it uses art that comes with the game because it's a simple button.

It really sounds like you didn't take the time to look at what it going on in there before making a decision about what I'm doing wrong. I didn't say anything about the entire GUI failing to load, I was talking about a button inside the GUI. And by GUI, I mean our GUI, which I couldn't be talking about if it wasn't even loading (in the case of appButton being null).

EDIT: I did a little research on the Unity API documentation and even their tutorial button code looks exactly like mine, which just makes this even more weird that it won't work for me.

- - - Updated - - -

Yup Gaalidas is right, the node definitions became more "strict" So Top is regular and the bottom node needs to be inverted. And looking over the cfg for the rover body, your nodes are defined in the .mu file correct? So before you would have

node_stack_top = 0.00, 0.4, 1.98, 0.00, 0.00, 1.00, 1

node_stack_bottom = 0.00, 0.4, -1.6, 0.00, 0.00, -1.00, 1

and now you would have

node_stack_top = 0.00, 0.4, 1.98, 0.00, 0.00, 1.00, 1

node_stack_bottom = 0.00, 0.4, -1.6, -0.00, 0.00, -1.00, 1

But because you defined them in the .mu file I honestly don't know how to fix that.

What now? Oh, is that the part that he used transforms to define the nodes in? yeah, so, if you were to define the nodes in the format that other parts tend to use, and strip out the transform nodes, it will simply use that form of node instead. The only reason for editing the model again is if you still want to use the transforms to define the nodes. My understanding is that the nodes are now much more strict about the orientation of a node when compared against the orientation of the connecting node on the other part. This could be nice when dealing with parts that have no attach node defined and are not capable of being attached radially. For instance, issues with really small engines being stack attached to a large fuel tank, you have a lot of issues with the engine wanting to snap to the bottom node with the bottom node of the engine, instead of attaching with the top node, and ending up inside the tank. I'm unsure if this was what they were going for, nor if it was successful, but that would make sense to me.

Edited by Gaalidas
Link to comment
Share on other sites

It really sounds like you didn't take the time to look at what it going on in there before making a decision about what I'm doing wrong. I didn't say anything about the entire GUI failing to load, I was talking about a button inside the GUI. And by GUI, I mean our GUI, which I couldn't be talking about if it wasn't even loading (in the case of appButton being null).

You seriously couldn't take two seconds to add a null check in there and instead wrote an entire ironic paragraph berating me for not taking the time to look? I don't think I said anything about the state of the GUI, I just used the power of deduction.

There is a perfect storm of logic that leads to what you claim is impossible. Ponder this: what if, somehow, there are two KFGUIManagers. One of them created the toolbar button but leads a sad half-existence because the GameObject it was riding was destroyed in a scene change and it got stuck in memory, making it incapable of OnGUI. The other never initializes. What if the first one (again, not capable of showing any GUI) were to toggle isGUIEnabled? How would that second, uninitialized manager react? Why ... it would start displaying its GUI. But you never know it's completely uninitialized until you try and access one of the things that was supposed to initialize.

Anyway, good luck

Link to comment
Share on other sites

What the HECK are going rambling on about? Do you really take me for a complete idiot? Two "KFGUIManagers" ?? You've got to be kidding me. There is only one KFGUIManager class in the entire project. I am not going to create two versions of something and then complain that it doesn't work. I'd have to be a complete idiot. I really don't appreciate bringing these idiotic thigns to my attention when you apparently have access to the code and can see that what you are proposing does not, in fact, exist. I really thought you were more intelligent than that. I'm having a legitimate problem here and you're giving me fantasy.

I'll grant you, it could have been destroyed improperly in a scene change, but get this: as the code clearly shows the application-button does NOT get created in a scene where it does not belong and, as I clearly stated, I am testing this in the initial load of the space center after first loading the game. Thus, there has been no other KFGUIManager doing any GUI rendering calls.

Now, what is this about "isGUIEnabled" that you're going on about? I'm not having trouble with that. As I clearly stated the GUI will close and open perfectly fine using the AppLauncher button. This is not the problem here. The problem is with a button (as in "GUI.Button()" and not the "appButton") inside the GUI window that is labeled "Save and Close" which, when clicked, is not returning it's true state like it is supposed to, which would allow me to execute some commands when it is clicked. Nope, instead it's giving me a NULLREF error in my log and ignoring everything between the braces of the "if" statement it's running in. Is this some strange coding on my part that is simply not correct? NO, because it's identical to a line of code I copied from another mod that I know for a fact WORKS!

So far, my impression of your "power of deduction" is that you need to get a tune up. Stop deducting and start reading the post so you know what the real problem is instead of spouting out completely insane ideas that are not even valid in this situation. Also, as I have told you before, I'm really not fully educated programmer, otherwise I likely would have this stuff working perfectly as of weeks ago. That being said, I have absolutely no clue where you want me to stick a null check, nor what I'm supposed to be checking for this null state. So no, I couldn't take two stupid seconds to do something that I have no idea how to do! If you're here to help, then help, and stop giving me all this stuff about things that don't even apply in this situation.

I simply cannot believe this. All I want is the stupid button to do what it does in every other mod I've looked at which uses a button in the same stupid way, and I'm being told I have duplicate instances of things running when the game only just started, and only just loaded the first toolbar it was about to create. Insane. Is there anyone out there who can actually help with the real problem here instead of everything but the real problem?

Edited by Gaalidas
Link to comment
Share on other sites

If appButton were null, then I wouldn't get a button on the toolbar, nor would I ever even get a GUI in the first place.

Perhaps you may most easily prove your point by inserting the check suggested.

Link to comment
Share on other sites

Maybe I shouldn't have used "ponder" and "what if" like I wasn't sure. I tracked down the problems and know exactly what they are. If you remove the appButton portion from your GUI.Button call, it won't throw. You've fixated on that for some reason.

Maybe the easiest way to convince you is to have you make IsGUIEnabled private instead of static. When your GUI suddenly stops appearing when the button is clicked, you can then ponder about why changing a shared variable to a per-instance variable has affected anything when there should only be one instance to begin with.

Link to comment
Share on other sites

I shouldn't have to prove that point simply because the check being suggested (and not in terms that I can even figure out how to do) isn't even having to do with the problem I am having. "appButton" is not null, otherwise there would be no button on the toolbar, nor any GUI being rendered on the screen. The button I am using is already inside the GUI window, and renders without issue. The issue is on the action when I click on it, and there's nothing in that which could be null because it's created within the same statement that tells it what to do. If it's null, it doesn't even appear. I can't click on a button that does not appear.

- - - Updated - - -

Maybe I shouldn't have used "ponder" and "what if" like I wasn't sure. I tracked down the problems and know exactly what they are. If you remove the appButton portion from your GUI.Button call, it won't throw. You've fixated on that for some reason.

Maybe the easiest way to convince you is to have you make IsGUIEnabled private instead of static. When your GUI suddenly stops appearing when the button is clicked, you can then ponder about why changing a shared variable to a per-instance variable has affected anything when there should only be one instance to begin with.

[redacted]. It's not doing anything with appButton in that area because it won't even activate anything within those brackets in the "if" statement, as I've been saying this whole time. It can't even get there at all because I've commented all of those commands out and left only a log entry in there to see if it was working and guess what? I got no log entryand a nullref instead. This has nothing to do appButton. Even without that in the area, the same thing happens. The button that is clicked on from the bottom of the GUI WINDOW is the problem, not "appButton." [redacted] my log entry code, I've been using it for weeks with no issue, and lo-fi or any of the others that are working on this mod and compile it from the github source could tell you that they work perfectly fine. It's the button itself, when clicked, that gives a nullref. "appButton" has nothing to do with it. In fact, the most recent edition of that code doesn't even mention "appButton" at all.

Edited by diomedea
redacted some "strong" expressions
Link to comment
Share on other sites

You're becoming quite hard to help. All I wanted was for you to add some statements inside your button code:

if (GUI.Button(new Rect(8f, 120f, 240f, 24f), "Save and Close"))
{
KFLog.Log("Save & closed was clicked");

if (appButton == null)
KFLog.Error("appButton is most definitely null");

KFLog.Log("This next line will definitely throw");
try
{
appButton.SetFalse();
}
catch (NullReferenceException e)
{
KFLog.Error("Received expected exception: " + e);
}
KFLog.Debug("Save-button clicked, called \"appButton.SetFalse()\"", strClassName);
}

a120d89ce8.png

If you can't even acknowledge where the problem might lie, you don't really have any chance of solving it

Link to comment
Share on other sites

You're becoming quite hard to help. All I wanted was for you to add some statements inside your button code:

if (GUI.Button(new Rect(8f, 120f, 240f, 24f), "Save and Close"))
{
KFLog.Log("Save & closed was clicked");

if (appButton == null)
KFLog.Error("appButton is most definitely null");

KFLog.Log("This next line will definitely throw");
try
{
appButton.SetFalse();
}
catch (NullReferenceException e)
{
KFLog.Error("Received expected exception: " + e);
}
KFLog.Debug("Save-button clicked, called \"appButton.SetFalse()\"", strClassName);
}

http://puu.sh/j3aui/a120d89ce8.png

If you can't even acknowledge where the problem might lie, you don't really have any chance of solving it

You weren't saying I needed to do that. You were giving me grief because I couldn't take two seconds to add a check against something being null that, since I was able to spawn a GUI window from a toolbar button at all, obviously isn't null. If you wanted something like what you posted, you could have actually said that. What I don't understand is how appButton could be null, considering we've already made it not-null and the only reason we have a button in the toolbar is because it has been defined. Because we have a button in the toolbar at all, and there has been no scene changes with a toolbar present, and the rest of the GUI is working perfectly fine, then appButton simply can't be null. It's completely impossible that it could ever be null, cause we're using it and it's already been used. It doesn't make any sense. Besides, it's not appButton that I'm having the problem with. Telling me to add thigns that I don't understand how to add, then telling me to ponder useless stuff, and in the end telling me what you wanted me to do all along but didn't have the time to actually say doesn't help me at all. Why waste all that time saying useless stuff? If you have some information that could be of help to me, then just say it. I'm not going to sit here playing guessing games.

Now that you've apparently made the button clickable without an immediate Nullref, I'd really like to know how you did that. Whenever I click the button, no matter what I put within the "if" statement brackets, all I get is an immediate nullref and nothing else. You somehow got it to send something to the log, but I don't see anything in the code you posted that is any different than what I've already tried. There's got to be more to it.

Edited by Gaalidas
Link to comment
Share on other sites

You weren't saying I needed to do that. You were giving me grief because I couldn't take two seconds to add a check against something being null that, since I was able to spawn a GUI window from a toolbar button at all, obviously isn't null. If you wanted something like what you posted, you could have actually said that. What I don't understand is how appButton could be null, considering we've already made it not-null and the only reason we have a button in the toolbar is because it has been defined.

Look, I'm trying to explain that the reason it's null is that you're dealing with an uninitialized instance of KFGUIManager. You have accidentally created two copies of KFGUIManager and the one that owns the button is not the same as the one that is displaying the GUI. Add some logging statements:

private string MyId = "";

void Awake()
{

MyId = Guid.NewGuid().ToString("n").Substring(0, 6);
KFLog.Log("KFGUIManager.Awake - " + MyId);

print(string.Format("States: LoadedSceneIsFlight {0}, LoadedSceneIsEditor {1}, LoadedScene == SpaceCentre? {2}, LoadedScene = {3}",
HighLogic.LoadedSceneIsFlight,
HighLogic.LoadedSceneIsEditor,
HighLogic.LoadedScene == GameScenes.SPACECENTER,
HighLogic.LoadedScene));

if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor || HighLogic.LoadedScene == GameScenes.SPACECENTER)
{
KFLog.Log("KFGUIManager: " + MyId + " Adding event calls");
GameEvents.onGUIApplicationLauncherReady.Add(SetupAppButton);
GameEvents.onGameSceneSwitchRequested.Add(OnSwitchScene);
}
}

Make sure you add OnDestroy and sprinkle the new MyId throughout the others. Add this too:

[KSPAddon(KSPAddon.Startup.Instantly, false)]
public class OnLevelWasLoadedPrinter : MonoBehaviour
{
private void Awake()
{
DontDestroyOnLoad(this);
}

private void OnLevelWasLoaded(int level)
{
print("OnLevelWasLoadedPrinter: " + ((GameScenes) level) + " (raw: " + level + ")");
}
}

It'll make what's going on more apparent.

Also add this:

if (GUI.Button(new Rect(8f, 120f, 240f, 24f), "Save and Close"))
{
KFLog.Log("You clicked " + MyId + "'s button");
KFLog.Log("Save & closed was clicked");

if (appButton == null)
KFLog.Error("appButton is most definitely null");

appButton.SetFalse();

KFLog.Debug("Save-button clicked, called \"appButton.SetFalse()\"", strClassName);
}

Go to the space center, open the GUI, click the button once. Let's look at the log (I've snipped some unrelated parts):

[WRN 05:22:00.752] [HighLogic]: =========================== Scene Change : From MAINMENU to SPACECENTER (Async) =====================
[LOG 05:22:01.029] [Kerbal Foundries]: KFGUIManager.OnDestroy ec3b52 // here is the one from MainMenu dying; that's fine
[LOG 05:22:01.241] OnLevelWasLoadedPrinter: LOADINGBUFFER (raw: 1)
[LOG 05:22:01.255] AddonLoader: Instantiating addon 'KFGUIManager' from assembly 'KerbalFoundries' // uh oh -- this is being created from the LOADINGBUFFER scene?
[LOG 05:22:01.256] [Kerbal Foundries]: KFGUIManager.Awake - [B][SIZE=3]0ab385[/SIZE][/B]
[LOG 05:22:01.260] States: LoadedSceneIsFlight False, LoadedSceneIsEditor False, LoadedScene == SpaceCentre? True, LoadedScene = SPACECENTER
[B][I][LOG 05:22:01.262] [Kerbal Foundries]: KFGUIManager: [B][SIZE=3]0ab385 [/SIZE][/B]Adding event calls
[LOG 05:22:01.958] [Kerbal Foundries]: [SIZE=3]KFGUIManager.OnDestroy [/SIZE][B][SIZE=4]0ab385[/SIZE][/B][/I][/B]
[LOG 05:22:02.218] OnLevelWasLoadedPrinter: SPACECENTER (raw: 5)
[LOG 05:22:02.227] [Kerbal Foundries]: [B][SIZE=4]0ab385[/SIZE][/B]: SetupAppButton event from GUIApplicationLauncherReady
[LOG 05:22:02.262] [Kerbal Foundries - KFGUIManager()]: App button added by [B][SIZE=3]0ab385[/SIZE][/B]
[LOG 05:22:02.292] AddonLoader: Instantiating addon 'AddScenarioModules' from assembly 'KSP'
[LOG 05:22:02.294] AddonLoader: Instantiating addon 'ContractDefs' from assembly 'KSP'
[LOG 05:22:02.328] AddonLoader: Instantiating addon 'CustomConfigsManager' from assembly 'ModuleManager'
[LOG 05:22:02.334] AddonLoader: Instantiating addon 'KFGUIManager' from assembly 'KerbalFoundries'
[LOG 05:22:02.336] [Kerbal Foundries]: KFGUIManager.Awake - [B][SIZE=5][SIZE=3]c6d96a[/SIZE][/SIZE][/B]
[LOG 05:22:02.339] States: LoadedSceneIsFlight False, LoadedSceneIsEditor False, LoadedScene == SpaceCentre? True, LoadedScene = SPACECENTER
[LOG 05:22:02.341] [Kerbal Foundries]: KFGUIManager: [B][SIZE=3]c6d96a [/SIZE][/B]Adding event calls
[LOG 05:22:02.880] [CustomConfigsManager] Setting moddeed physics as the active one
[LOG 05:22:02.883] PhysicsGlobals: Loading database
[ContractSystem]
[Building ScenarioModule]
[Resource system init]
[B][LOG 05:22:10.335] [Kerbal Foundries]: You clicked [SIZE=3]c6d96a[/SIZE]'s button[/B]
[LOG 05:22:10.338] [Kerbal Foundries]: Save & closed was clicked
[ERR 05:22:10.341] [Kerbal Foundries]: appButton is most definitely null
[EXC 05:22:10.346] NullReferenceException: Object reference not set to an instance of an object
KerbalFoundries.KFGUIManager.DrawWindow (Int32 windowID) (at d:/For New Computer/KSPCustomMods/KF_plugin-master/KF_plugin/KFGUIManager.cs:243)
UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style)

Look at this very, very closely. 0ab385 adds itself to the events in the LOADINGBUFFER scene. It's been tricked into doing this because HighLogic.LoadedScene just happens to be SPACECENTER while in LOADINGBUFFER. The scene then changes, destroying its GameObject... but the C# side of it isn't garbage collected because it has been pinned in memory by the events it signed itself up for.

Now, immediately after the space center begins loading, we see SetupAppButton. But wait, that KFGUIManager (0ab385) was destroyed! That one won't have a functioning GUI because Unity destroyed its GameObject. Moving on, the correct, functioning KFGUIManager (c6d96a) has added itself to those callbacks. It should initialize soon. But wait a minute, look around -- c6d96a never initializes! Where is its button?

Now at this point there are two instances of KFGUIManager. 0ab385 was clearly destroyed but owns a button and is still stuck in memory because other things have references to it. c6d96a registered for events but those events never came and it remains uninitialized. They share the static isGUIEnabled so when 0ab385 toggles isGUIEnabled, BOTH 0ab385 and c6de96a should begin showing their GUI. Except that 0ab385 had its GameObject destroyed and never receives any OnGUI calls. The OnGUI you see is from c6d96a.

Accessing any of the things inside c6d96a that should've initialized (appButton) will throw NullReferenceException because it was never initialized -- it's still patiently waiting for those GameEvents to occur. Accessing any MonoBehaviour properties of 0ab385 will throw because it was destroyed. Try printing the name of KFGUIManager's gameObject inside SetupAppButton and you'll see another exception involving get_gameObject to prove this is the case.

Link to comment
Share on other sites

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