Chapter 2: Asset catalogs - issue with background color

I’m using Xcode (8.1), and there have to be blue background color, but I get black one!
I get the same result when I run final project from the Book’s resources of the 2nd chapter.

Question is, how to resolve this to get the blue background as it is in book?

1 Like

I’ve found related topic in this forum, but I actually don’t get it, how to fix this problem!

To get the result like it is in book, I putted images in Assets.xcassets/Texture folder +
changed the method setupScene() to:

func setupScene() {
    ...
    scnScene.background.contents = "Textures/Background_Diffuse.png"
}

The problem I think is the alpha channel property of the PNG. You can see that it is “No” from the File Inspector, or Get Info of the PNG file. Once changed to “Yes”, it will turn to blue.

This issue might probably be caused because the GeometryFighter.scnassets folders and all underlying files are not assign their membership to the target, i.e., your app.

Select the .scnassets folder check the file inspector and in “Target Membership”, click on the checkbox to include these files in Target Membership, this problem will be solved.

Alpha property has nothing to do with this. Alpha simply denotes transparency of the image. This has to do with files being included in the path of your application.