Start the game via Steam, In Visual Studio, Debug -> Attach to Process, select the total miner process, turn on 'Break On Exception' or put a break point in the InitializeGame method, activate the mod in game and start a world, and use the debugger to find out what is wrong in the InitializeGame method.

Okay, I put the sound file into the mod folder, but I still get the same error.

*UPDATE* My apologies for taking your time. I found my small error and got it fixed, though the sound doesn't play. I'm sure I can find that error. Thanks for sticking around with me, it really means a lot!

I'm trying to set it to play the sound effect at the press of a key, I press the key, but no sound

*UPDATE* I have it set to notify me when the button is pressed. That all works, but it still doesn't play the sound. How do I execute the script (what is the script) to play the sound at the press of a key? As I said, when I press the assigned key, I get the notification, but no sound is played.

Not sure if this has been answered yet but his works, I tested it. Without seeing your code we cant help much. But if you get the notification when you press the button but no sound it makes me think there is a problem with the sound file.

if (InputManager.IsKeyPressed(tmPlayer.PlayerIndex, Keys.P)){ SoundEffect sound = game.AudioManager.LoadSoundEffectFromStream(FileSystem.RootPath + Mod.Path + "357_reload1.wav"); sound.Play();}p.s. if you havent joined TM discord I would suggest it, these question usually get answered pretty quickly in the modding section. http://totalminerforums.net/index.php?topic=18450.0

It will be loading and playing the sound effect 60 times a second. That will likely be problematic. Better to use InputManager.IsKeyPressedNew or InputManager.IsKeyReleasedNew. This ensures the sound effect is only played once per key press.

Also it is inefficient to load a sound effect from disk every time you want to play it. It will likely cause frame rate stutters. It is better to cache all sound effects by loading them once when the mod is initiailized (see the LockPick example on github).

Also if you plan on using the sound effect rapidly, like say for machine gun fire, then it is better to use the SoundEffectInstance type over the SoundEffect type. It allows more control the playing of several instances of the sound effect better, even if the sound overlaps each other, and gives other control you don't have with SoundEffect.