I want to setup different colours for the background starfield in my game. If I call the set theme function from inside the parallax background instance it works ok. But if I call it externally the colour doesn't change (although it appears to have changed when I look at the modulate property in the inspector). I'm modulating the sprites BTW, but also tried the same with the actual layers. Example below is the working version
extends ParallaxBackground
var _offset = 3
var _location = 0.0
func process(delta):
_location = _location + _offset * delta
scrolloffset.y = _location
func setbackgroundtheme():
print(Global.colours.size())
print(randi() % Global.colours.size())
var dictcolour = Global.colours[randi() % Global.colours.size()]
print(dictcolour)
Global.backgroundtheme = Global.colourschemes[dictcolour]
$Background.modulate = Global.backgroundtheme["background"]
$FarLayer.modulate = Global.backgroundtheme["FarSprite"]
$MidLayer.modulate = Global.backgroundtheme["MidSprite"]
$NearLayer.modulate = Global.background_theme["NearSprite"]
func onTimertimeout():
setbackground_theme()
pass # Replace with function body.