SpriteKit refresh during live resize

Hi SpriteKit community,


My question pertains to the refresh of SpriteKit during live resizeDuring a live window resize on MacOS: SpriteKit's SKScene update function invokes properly, yet SpriteKit Views scenes are not redrawn until the window resize event completes. Is this expected behavior/a limitation of SpriteKit, or is there likely something wrong in my application's configuration? I've tried about every permutation of layerContentsRedrawPolicy, preservesContentDuringLiveResize, referenced the relevant documentation (https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/CocoaLiveResize.html#//apple_ref/doc/uid/TP40001444-BAJGDIBE, etc.) for both Live Resize, SKScene, and SKView itself, set a timer to invoke update and needsDisplay manually, etc., yet no dice as far as drawing updates during the resize event. Any help would be most appreciated!


Much thanks, in advance!


Jonathan

Replies

2 years later...

I found a simple way to force an SKView to live resize on Mac; just make it think it's not live resizing and it won't halt the redraws:

Code Block swift
class LiveResizeSKView: SKView {
    override public var inLiveResize: Bool {
        get {
            return false
        }
    }
}


  • hi, how do you use it? thank's

Add a Comment