Project

General

Profile

Bug #1991

[Race Condition?] Incorrect Camera View when Switching Vessels from Map

Added by toadicus over 10 years ago. Updated over 7 years ago.

Status:
Closed
Severity:
Normal
Assignee:
-
Category:
Controls and UI
Target version:
-
Start date:
12/19/2013
% Done:

100%

Version:
Platform:
Any
Expansion:
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

When switching from one vessel to another via the map (but not when switching to a vessel from the Tracking Station), a NullReferenceException is thrown and results in an incorrectly oriented view (the camera is zoomed all the way out). This exception is fired at least once, and probably twice for most manned vessels.

Traces from output_log.txt:

@[HighLogic]: =========================== Scene Change : From FLIGHT to FLIGHT =====================

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

NullReferenceException: Object reference not set to an instance of an object
at FlightGlobals.getStaticPressure (Double altitude, .CelestialBody body) [0x00000] in <filename unknown>:0

at FlightGlobals.getStaticPressure () [0x00000] in &lt;filename unknown&gt;:0 
at InternalAtmosphereDepth.OnUpdate () [0x00000] in &lt;filename unknown&gt;:0 
at InternalProp.OnUpdate () [0x00000] in &lt;filename unknown&gt;:0 
at InternalModel.OnUpdate () [0x00000] in &lt;filename unknown&gt;:0 
at Part.InternalOnUpdate () [0x00000] in &lt;filename unknown&gt;:0 
at Part.Update () [0x00000] in &lt;filename unknown&gt;:0

(Filename: Line: -1)

[PlanetariumCamera]: Focus: Mun

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

UnloadTime: 6.115859 ms
Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

Unloading 321 unused Assets to reduce memory usage. Loaded Objects now: 70112.
Total: 69.868431 ms (FindLiveObjects: 3.465739 ms CreateObjectMapping: 2.346693 ms MarkObjects: 62.774784 ms DeleteObjects: 0.879092 ms)

Camera Mode: AUTO

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

NullReferenceException: Object reference not set to an instance of an object
at FlightGlobals.getStaticPressure (Double altitude, .CelestialBody body) [0x00000] in <filename unknown>:0

at FlightCamera.GetAutoModeForVessel (.Vessel v) [0x00000] in &lt;filename unknown&gt;:0 
at FlightCamera.setMode (Modes m) [0x00000] in &lt;filename unknown&gt;:0 
at FlightCamera.setModeImmediate (Modes m) [0x00000] in &lt;filename unknown&gt;:0 
at MapView.exitMapView () [0x00000] in &lt;filename unknown&gt;:0 
at MapView.ExitMapView () [0x00000] in &lt;filename unknown&gt;:0 
at FlightUIModeController.SetMode (FlightUIMode mode) [0x00000] in &lt;filename unknown&gt;:0 
at FlightUIModeController.Start () [0x00000] in &lt;filename unknown&gt;:0

(Filename: Line: -1)

------------------- initializing flight mode... ------------------

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

Target vessel index: 1 vessel count: 6

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

[FLIGHT GLOBALS]: Switching To Vessel Kerbal 2 ----------------------

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

setting new dominant body: the Mun
FlightGlobals.mainBody: the Mun

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

Camera Mode: AUTO

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

stage manager resuming...

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

all systems started

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

[asasmodule1-2]: Activated (forced)

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

[RCSTank1-2]: Activated (forced)

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

[fuelTank4-2]: Activated (forced)

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

[liquidEngine1-2]: Activated (forced)

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

[winglet3]: Activated (forced)

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

[winglet3]: Activated (forced)

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

[winglet3]: Activated (forced)

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

[RCSBlock]: Activated (forced)

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

[RCSBlock]: Activated (forced)

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

[RCSBlock]: Activated (forced)

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

[RCSBlock]: Activated (forced)

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

[solarPanels5]: Activated (forced)

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

[solarPanels5]: Activated (forced)

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

[solarPanels5]: Activated (forced)

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

[solarPanels5]: Activated (forced)

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

[PlanetariumCamera]: Focus: Kerbal 2@

From a quick examination of the API assembly, it looks like FlightGlobals.getStaticPressure(double, CelestialBody) is being called with a null Body reference before FlightGlobals.currentMainBody is assigned.

Steps to reproduce:

  1. Put a vessel in orbit of Mun
  2. Put a second vessel in orbit of Mun
  3. Switch from one vessel to the other via the map view

It probably works for all bodies and in all starting positions, but I haven't tested otherwise. I have duplicated this bug in Windows 8 64-bit and Linux x64.

History

#1 Updated by TruePikachu about 10 years ago

I'll check this issue out in my copy. Loading

For the meantime, a workaround would be to only switch ships from the flight center.


I was just unable to reproduce, Win7x64. I loaded to some launch pad debris, and map switched to a sattelite that was near Kerbin, on an escape trajectory. No crash, no NPE on the debug.

Have you duplicated it with seperate games on Windows and Linux, or with a copied save file? If the latter, it might be something more or less specific to the save.

#2 Updated by TruePikachu about 10 years ago

  • Status changed from New to Confirmed
  • % Done changed from 0 to 10

I recently confirmed this, using two ships in orbit around Mun, and both controllable.

#3 Updated by TriggerAu over 7 years ago

  • Status changed from Confirmed to Needs Clarification
  • % Done changed from 10 to 0

#4 Updated by sal_vager over 7 years ago

  • Status changed from Needs Clarification to Ready to Test
  • % Done changed from 0 to 80

This appears to have been fixed.

#5 Updated by JPLRepo over 7 years ago

  • Status changed from Ready to Test to Closed
  • % Done changed from 80 to 100

Also available in: Atom PDF