1 Reply
      Latest reply on May 20, 2019 12:09 PM by fermor
      fermor Level 1 Level 1 (0 points)

        We are trying to generate an SKTexture (texture) from the rendering of an SKNode (node) in an SKScene presented to an SKView (view)


        let origin = CGPoint (x:0, y:0)
        let rect = CGRect(origin:origin, size:CGSize(width:100, height:100))
        let texture = view?.texture(from:node, crop:rect)


        The resulting texture is always the same regardless of the origin value.

        Has anybody ran into this issue before?

        • Re: SKTexture from the texture(from:crop:) method doesn't change with changes in crop CGRect
          fermor Level 1 Level 1 (0 points)

          Well, this problem is related to using the SKScene (which is the root node of the scene) as the node to crop. This seems to be a known Apple bug (#29005461) that was submitted on 2016 and it seems it has never been fixed (Wow! 3 years.  Every place that I have worked in, a bug this serious that hasn't been solved for 3 years is unheard of and totally unacceptable). There is a workaround, you have to create your own root SKnode and use the method on that node instead.