You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above case I would rather FlxG.sound.play throw an error saying you're trying to play a null sound, rather than silently continuing and assuming this is something the dev wanted to happen
Well I agree here too but in this case you'll have to rewrite a lot. Is it possible to regulate this somehow, like if the developer wants onComplete to be called even if there's no sound? Of course, you can do something like that
And when I was testing builds by deleting assets and checking game's operation (so that it didn't break down due to lack of pictures, sounds) and when I clicked on items in the menu, game just stopped and because of this, menu hung because input blockers were triggered and only restarting helped
And thats why I created issue
Activity
Geokureli commentedon Jun 11, 2026
Can I get a practical code example that illustrates the issue with the old code? also can you link to the code lines you're trying to change?
SimonArs commentedon Jun 11, 2026
Yes, right here
https://github.com/HaxeFlixel/flixel/blob/dev/flixel/sound/FlxSound.hx#L769-L790
Imagine situation when at end of a certain sound we need to switch to another state for example:
And if sound is null for some reason, nothing will happen and
onCompleteisnt called, so I think it'd be better to addin
startSoundfunction if sound is nullGeokureli commentedon Jun 12, 2026
In the above case I would rather
FlxG.sound.playthrow an error saying you're trying to play a null sound, rather than silently continuing and assuming this is something the dev wanted to happenSimonArs commentedon Jun 12, 2026
Well I agree here too but in this case you'll have to rewrite a lot. Is it possible to regulate this somehow, like if the developer wants
onCompleteto be called even if there's no sound? Of course, you can do something like thatBut for me itsa waste of time
Well I leave decision to you
Geokureli commentedon Jun 12, 2026
Can you tell me more about the actual case you came across that needed this change?
SimonArs commentedon Jun 12, 2026
I made Easter eggs in Main Menu of my game, and when you click on certain object, sound is played and at end of sound, transition to PlayState occurs
And when I was testing builds by deleting assets and checking game's operation (so that it didn't break down due to lack of pictures, sounds) and when I clicked on items in the menu, game just stopped and because of this, menu hung because input blockers were triggered and only restarting helped
And thats why I created issue
Geokureli commentedon Jun 12, 2026
Did flixel warn that you tried to load/play a missing sound?
SimonArs commentedon Jun 12, 2026
Yes of course