Sorry for my poor English ~~
I’m a beginner for MonoGame.
Now I want to add some sound effects into my game.
Here is my code.
//----------------------------------↓↓↓↓↓↓↓↓↓↓-----------------------------------------
class MyGame : Game
{
SoundEffect soundEffect;
SoundEffectInstance soundinstance;
//…
protected override void LoadContent()
{
//...
soundEffect = Content.Load<SoundEffect>("sound1"); // sound1.wav
soundinstance = soundEffect.CreateInstance();
}
protected void DoSomething()
{
//...
soundinstance.Play();
}
}
//-------------------------------↑↑↑↑↑↑↑↑↑↑↑↑-----------------------------------
When I called DoSomething method, there is just no sound. Why?
How can I fix the prob?
Thanks for help!
I found it was no sound if I use the “MonoGame Windows Project” template. But when I change the template to “MonoGame Windows 10 Universal Project” , I can hear the sound!
Why?