|Topic was automatically imported from the old Question2Answer platform.
I have a main scene, and all other scenes in the game are instanced under it sequentially. It has multiple theming options, and I need the black bars to be consistent with the theme that is selected. It only needs to be a flat colour, but I couldn’t find a way to simply change their colour, so I used this:
VisualServer.black_bars_set_images(texRID, texRID, texRID, texRID)
This gets the RID from a 2x2 pixel png with the colour it needs. The problem is, whenever there is a change of scene, the black bars flash white, and I’m not sure why. If I disable this line, the black bars are there, and do not flash, and generally just behave as black bars would normally behave. How can I get rid of this white flashing? And is there a better way to simply change their colour, rather than using this workaround?
Where are you executing that instruction? I assume on an autoload script?
p7f | 2020-06-25 17:37
No, the function is executed on the main thread. Is that the wrong place to have it?
psear | 2020-06-25 18:00
What do you mean with the main thread? Which script has that instruction?
I’ve just tested this way and worked correctly. I created a script, i loaded the texture and called the
black_bars_set_images function, and then set that script as an autoload in the project settings. If you have that function in a script attached to a scene, i think when you change the scene, possibly the resource is fred and then loaded again, and causes that glitch. But if you set it as an autoload (or singleton), it will remain loaded all time.
p7f | 2020-06-25 18:15
That might be it. It’s under the root node, in a function which is called by _ready(). I’ll try using an autoload script.
psear | 2020-06-25 18:19
Ok, i’ll add it as an answer, because it working for me. Tell me if it works!
p7f | 2020-06-25 18:21
I gave it a shot, I had a feeling it might not work because the node which calls this is never cleared, it’s all the nodes instanced under it which chain together. But is this really the way to change the colour of black bars? Is there a more “conventional” way?
psear | 2020-06-25 19:39