Jump to content

Niven

Members
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Neutral

Profile Information

  • About me
    Curious George

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. SOLVED! For anyone else who runs into this, all you need to do is call DoNotDestroy.DontDestroyOnLoad([GameObject]); I'm rather new to programming in general so this may be some simple issue with fundamentals, but I'm having the following problem: I'm making a basic flight warning system, using textures and sounds to alert the user to certain conditions (e.g. low fuel, high temperature, etc). On Start() I load the textures and sound files in separate modules, e.g. Start() { CraftView.LoadTextures() NoiseMaker.LoadSounds() } The textures work fine, but the sound files only work until I either switch to another vessel or leave flight for the VAB/space center/etc. After this any time I try to play a sound file I just get a null reference exception. I gather that I need to reload the sound files again somehow but if I simply call NoiseMaker.LoadSounds() again on scene change I get a game crippling error where the null references go into overdrive and you get the "blue word/semi underground kraken" type visual bug. Could someone smarter than me shed some light on what it is I don't understand here? The basic structure of NoiseMaker.LoadSounds is: sound_one = GameObjectName.AddComponent<AudioSource>(); sound_one.panLevel = 0; sound_one.clip = GameDatabase.Instance.GetAudioClip("path/to/sound/file"); sound_one.loop = false; <repeat for other sounds> Sample log output: NullReferenceException at KAWS.NoiseMaker.RefreshSounds () [0x00000] in <filename unknown>:0
  2. Does anyone have any idea for an easy way to check if service/cargo bay doors are open/closed? For landing legs & solar panels I just used FindPartModulesImplementing to find each part and then looped through checking the state (legState/StateString), but <ModuleCargoBay> doesn't seem to have any state/status/etc value I can find.
×
×
  • Create New...