Simple things like this trip up us newbies. I spent way to long trying to figure out how I can have my music volume slider on my main gui menu. Issue is you can’t address go.set or go.get properties from the collection…especially since the collection doesn’t even exist yet.
So I just write the setting to a file. Then when the collection loads I retrieve that setting. In fact, it works perfectly this way as it keeps the setting between game sessions.
--save volume setting so it can be accessed by other collections
local function load_music_volume()
local filename = sys.get_save_file("kabocha", "musicvolume")
local data = sys.load(filename)
return data.volume or .5
end
local function save_music_volume(volume)
local filename = sys.get_save_file("kabocha", "musicvolume")
sys.save(filename, { volume = volume })
end