Lol you guys are right I'm not sure what I was thinking. Just putting it in the update method worked.
There is currently a compatibility issue with the contents of the window.
As Kaelan mentions, after changing the skin, the contents must be re-drawn.
This is because windowskins also hold information about font colours.
The default scripts use a "refresh" method for almost every window, so this is nice: I can just call that method if it exists.
If your window does not have a refresh method, and instead draws things on their own, then you won't be able to dynamically change the contents of the window (which means the skin would change, but the fonts are still the old one until you re-create the window)
What about applying what scene_base handles as an instance variable, it already updates and disposes them so why not apply the window skin property?
#==============================================================================# ** Scene_Base#------------------------------------------------------------------------------# This is a superclass of all scenes in the game.#==============================================================================class Scene_Base #-------------------------------------------------------------------------- # * Set Windowskin #-------------------------------------------------------------------------- def set_windowskin(name) instance_variables.each do |varname| ivar = instance_variable_get(varname) ivar.windowskin = Cache.system(name) if ivar.is_a?(Window) end endend
This is the solution I would prefer, because ideally you only want to set the windowskin when you actually call a method that changes the windowskin. I've designed it so that any access to $game_system.windowskin= should trigger the change.
However, I am aware of several scripts that define their own scene classes...that don't inherit from Scene_Base for some reason. Currently I've placed it in the Window's update method, under the assumption that no one is creating their own window that doesn't inherit from it.