Making a SKScene's background transparent not working… is this a bug?

Is there a way to make a SKScene’s background transparent and present that scene over another one seeing thru the transparency.

The idea is to have the background of the presented scene like this:

  • How to create several UIButtons along a path/BezierCurve?
  • “Reading from public effective user settings” in iOS 10
  • Facebook SDK 4.7 Login error handling
  • What Design Patterns are used on iOS other than MVC?
  • ld: library not found for -lGoogleAdMobAds
  • Send App to Background process
  • self.backgroundColor = [SKColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f];
    

    what would allow to see the scene behind darken. But doing this is not working. Background is presented completely opaque.

    Is there a way to do that?

    5 Solutions Collect From Internet About “Making a SKScene's background transparent not working… is this a bug?”

    In iOS 8, you can set the scene’s SKView to allow transparency and set the scene’s background color to have transparency. Then views behind the SKView will be seen.

    UIView *parentView = ...;
    [parentView addSubview:backgroundView];
    [parentView addSubview:skViewWithScene];
    skViewWithScene.allowsTransparency = YES;
    scene.backgroundColor = [UIColor clearColor];
    [skViewWithScene presentScene:scene];
    

    Transparency works only for iOS 8, have to check for iOS 7

    In the ViewController set transparency as :

    SKView *skView = (SKView *)self.mySKView;
    SKScene *skScene = [MyScene sceneWithSize:skView.bounds.size];
    skScene.scaleMode = SKSceneScaleModeAspectFill;
    skView.allowsTransparency = YES;
    [skView presentScene: skScene];
    

    In MyScene.m set background as clear color:

    self.scene.backgroundColor = [UIColor clearColor];

    I think that’s not possible, since I tried everything as far as my knowledge goes, it keeps ignoring the alpha value.

    Which is not logical since it works on top of OpenGL, but the SKView is subclassed from UIView, not from GLKView.

    You can’t make the scene transparent. If anything you’ll want to make the view transparent.

    However you can’t have two scenes running at the same time (only transitioning between them), and while you can add multiple SKView to a Storyboards page only one of the views will update at full speed, they other frozen or changing contents only every couple seconds.

    swift 3

    @IBOutlet var gameScene: SKView!
    
    func setupGameScene(){
    
        if let scene = SKScene(fileNamed: "GameScene") {
            scene.scaleMode = .aspectFill
            scene.backgroundColor = .clear
            gameScene.presentScene(scene)
            gameScene.allowsTransparency = true
            gameScene.ignoresSiblingOrder = true
            gameScene.showsFPS = true
            gameScene.showsNodeCount = true
        }
    }