title: Changing texture for subclass of SKSpriteNode?
body: <p>The <code>update</code> function in the class below, which is a subclass of SKSpriteNode, is supposed to change the texture of the class. According to <a href="https://stackoverflow.com/questions/27460191/changing-image-of-a-skspritenode">this SO answer</a>, updating the <code>texture</code> property is sufficient for changing a SKSpriteNode's texture. However, this code doesn't work.</p>
  
  <p>Any ideas why?</p>
  
  <pre><code>class CharacterNode: SKSpriteNode {       
      let spriteSize = CGSize(width: 70, height: 100)
  
      var level = 0
  
      init(level: Int) {
          self.level = level
          super.init(texture: nil, color: UIColor.clear, size: spriteSize)
      }
  
  
      required init?(coder aDecoder: NSCoder) {
          fatalError("init(coder:) has not been implemented")
      }
  
  
      func update(level: Int) {
          self.level = level            
          self.texture = textureForLevel(level: level)
      }
  
  
      func textureForLevel(level: Int) -&gt; SKTexture {
          return SKTexture(imageNamed: "TestTexture")
      }
  </code></pre>