I have a Main_Menu widget that starts music, when I click the Options menu and hit Return the music starts again, duplicating the music track, this is because of the ‘Event On Initialized’ event, but how do I make it so that the music only plays once when returning to the Main Menu?
Start Music at Main Menu then access the Options sub-menu (secondary widget)
But you do not return to Main Menu. You create another Main Menu. Now you have 2 main menus. For a while at least; since the Main Menu is not referenced (never was? - we can’t see how it’s created for the first time), it will be scooped up by the Garbage Collection in a little while.
Perhaps look into how a Widget Switcher works. Think of it as of a book where each widget is a page and the book can only show one page at a time. You can switch between the pages without having to remove / create them. And since all pages exist, you can still control with them, even though they’re not showing atm.
The above can be set up better but should work just fine for a menu with a dozen or so screens. It, of course, assumes we’re displaying one menu at a time rather than some multilayered overlapping fancy 3d carousel stuff.
Thanks for responding, I have created the widgets, made them variables in the ‘myWidget’ and added them into the graph as variables but I can’t see an option for ‘Set Active Widget’ or the ‘Widget Switcher 32’ variable or a ‘Set Active Widget Index’
Don’t hook it to initialise then. Have a custom event and call it when needed.
The thing is that I see what there is duplicate? This should never ever fire more than once since this widget just sits and does nothing else but controls other bits.