S-C-A-N / SCANsat

Real Scanning, Real Science, at Warp Speed!
217 stars 97 forks source link

Scan missions keep appearing and disappearing (Game-breaking) #302

Closed SteenSchutt closed 6 years ago

SteenSchutt commented 6 years ago

I'm not exactly sure whether this is caused by SCANsat or not, but since this behaviour occurs on those contracts only, I figured that's the best bet.

The problem is, that I just completed a contract for doing a low res scan of Kerbin. Often I send a probe to the celestial body before accepting the contracts, as I then won't have to decline it if I need to do other things before I can get to finish it. So I sent a probe to the Mun with a scanner, and started scanning. Then I went to Mission Control to accept the contract, but for some reason the scan Mun and scan Minmus contracts are constantly appearing and disappearing. I tried restarting the game to no avail. This is particularly problematic, as it also prevents me from accepting other contracts, and because of this, I can't really continue.

I am using SCANsat v18.1 installed through CKAN v1.22.5 for KSP v1.3.1. You can find the KSP log file here: https://gist.github.com/DoctorBlue/71fad9e7fc1feb1948d01b58b5c5a383

There is a bunch of likely-to-be-interesting exceptions near the end of the log file. I'll leave them here for convenience:

[ERR 08:22:15.271] Exception handling event Contract.Finished in class MissionControlUI:System.NullReferenceException: 
  at (wrapper managed-to-native) UnityEngine.Behaviour:get_isActiveAndEnabled ()
  at UnityEngine.EventSystems.UIBehaviour.IsActive () [0x00000] in <filename unknown>:0 
  at UnityEngine.UI.Graphic.SetLayoutDirty () [0x00000] in <filename unknown>:0 
  at UnityEngine.UI.Graphic.SetAllDirty () [0x00000] in <filename unknown>:0 
  at UnityEngine.UI.Image.set_sprite (UnityEngine.Sprite value) [0x00000] in <filename unknown>:0 
  at KSP.UI.ButtonState.Setup (UnityEngine.UI.Button button, UnityEngine.UI.Image image, TMPro.TextMeshProUGUI text) [0x00000] in <filename unknown>:0 
  at KSP.UI.UIRadioButton.SetState (State state, CallType callType, UnityEngine.EventSystems.PointerEventData data, Boolean popButtonsInGroup) [0x00000] in <filename unknown>:0 
  at ContractConfigurator.Util.MissionControlUI.HandleRemovedContract (Contracts.Contract c) [0x00000] in <filename unknown>:0 
  at ContractConfigurator.Util.MissionControlUI.OnContractFinished (Contracts.Contract c) [0x00000] in <filename unknown>:0 
  at EventData`1[Contracts.Contract].Fire (Contracts.Contract data) [0x00000] in <filename unknown>:0 
[EXC 08:22:15.274] NullReferenceException
    UnityEngine.EventSystems.UIBehaviour.IsActive ()
    UnityEngine.UI.Graphic.SetLayoutDirty ()
    UnityEngine.UI.Graphic.SetAllDirty ()
    UnityEngine.UI.Image.set_sprite (UnityEngine.Sprite value)
    KSP.UI.ButtonState.Setup (UnityEngine.UI.Button button, UnityEngine.UI.Image image, TMPro.TextMeshProUGUI text)
    KSP.UI.UIRadioButton.SetState (State state, CallType callType, UnityEngine.EventSystems.PointerEventData data, Boolean popButtonsInGroup)
    ContractConfigurator.Util.MissionControlUI.HandleRemovedContract (Contracts.Contract c)
    ContractConfigurator.Util.MissionControlUI.OnContractFinished (Contracts.Contract c)
    EventData`1[Contracts.Contract].Fire (Contracts.Contract data)
    UnityEngine.Debug:LogException(Exception)
    EventData`1:Fire(Contract)
    Contracts.Contract:SetState(State)
    Contracts.Contract:Update()
    ContractConfigurator.ContractPreLoader:Update()
[EXC 08:22:24.984] NullReferenceException: Object reference not set to an instance of an object
    ContractConfigurator.Util.MissionControlUI.OnClickAccept ()
    UnityEngine.Events.InvokableCall.Invoke (System.Object[] args)
    UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters)
    UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters)
    UnityEngine.Events.UnityEvent.Invoke ()
    UnityEngine.UI.Button.Press ()
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData)
    UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData)
    UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor)
    UnityEngine.EventSystems.EventSystem:Update()

Oh, and thanks a lot for writing this wonderful addon :smile:

DMagic1 commented 6 years ago

I've never seen that kind of exception before, it would seem to indicate something is wrong with the Unity UI objects in the Mission Control Center.

I'm going to rewrite the contracts so that they avoid the flickering problems (the contracts rapidly change from available to not-available before settling on all being unavailable) and other issues that prevent people from getting any contracts to do. So hopefully that should get rid this problem, too.

SteenSchutt commented 6 years ago

Nice! I managed to "fix" the problem by just scanning the Mun without accepting the mission, but would be nice of the bug was fixed completely :)

DMagic1 commented 6 years ago

See here for information about new contracts: https://forum.kerbalspaceprogram.com/index.php?/topic/72679-13x-scansat-v181-real-scanning-real-science-at-warp-speed-october-11-2017/&do=findComment&comment=3200203

You can download the files here: https://github.com/DMagic1/SCANsat/tree/release/SCANassets/Resources/Contracts

DMagic1 commented 6 years ago

The new contracts are out in version 18.2. They should resolve all of the flickering issues and generally work better.