In my game i have an button to watch ads. After you click on that, and the reward video is closed. You see a animation and a sound. This only works the first time after opening the game. When you do the exact same thing the second time, the sound doesn’t play but the rest of the events does work well. How to fix this?
I have tried multiple options. Like without the trigger once, or on diffrent placements under the conditions. But always with the same outcome.
These are the events i have right now :
How to fix this? So that everytime the ad is finished i hear a sound.
What are the values of the variables sound and gluidextra after the second time the ad plays?
That stays the same. It should work,and i dont get why it doesnt work.
So the value of sound is always 0 in this instance. And the value of geluidextra is 0 at the start of the scene. After the ad plays the value changes to 1. So the 1st time it does that, 2st ,3st etc.
In the home of the game i change the value of geluidextra to 0. It was first in these events, but i tried many thing to make this work. So i tried to reset it in the home.
Sound doesn’t play after the 1st time of playing it.
Everytime i watch an ad the text changes to “KLIK”.
So i really dont get why the sound isn’t working. Does anybody know a fix or work around for this? This is the only thing i have to fix before i can release the game.
A few things to check:
- Outside of 1 very specific scenario (an assets subfolder) GDevelop does not natively support subfolders in projects or resources. While I realize it may frustrate some folks, you should really not move your sounds outside of the main project folder (or into a subfolder). You should try moving it back to the project folder to avoid any weird oddities.
- Ensure the sound file is set as preloaded in resources.
- Remove the variable checks entirely and add a key press instead.
If 1 and 2 don’t fix it, but 3 does, then it’s something going on with your variables.
Here’s a test from Not-a-vania, just to check:
Thanks for the info. How can i ensure that the sound file is set as preloaded in resources?
Can’t find something like that in the resource page.
- Moved the sounds to main folder, doesnt work.
- The sounds play perfectly here.
I found out the problem. I have removed the “Play the sound on channel” and made an new “Play the sound on channel” action. And now it works.
I guess that i copied the action from somewhere else. And inserted a new sound in that action “Play the sound on channel”. So is this a bug then?