XCode Has No Option to Enable Texture Atlas Generation - ios

I'm following along with this apple doc, but for some reason when I search for "Sprite" under Build Settings in XCode nothing pops up. I've also tried searching for "Enable Texture Atlas Generation" and nothing comes up.
I have Xcode 5.0.2 if that helps.

The SPRITEKIT_TEXTURE_ATLAS_OUTPUT settings will be there in a new project but the SpriteKit Deployment Options will be created later. Of course you must select SpriteKit Game template when you create the project.
These settings added automatically to your project when you add the first texture atlas resource to it. You need to add a folder named with the .atlas extension. For example you have textures for your hero the atlas should be named as hero.atlas.

I was bedeviled by this exact issue for the past day, when I discovered that if I add an atlas to the project by dragging and dropping, the Sprite Kit Texture Atlas Options were not added to the Build Settings. If I chose File > Add Files to... from the menu bar, however, the Sprite Kit Texture Atlas Options appeared in the Build Settings.
So, apparently, do not drag and drop to add a texture atlas.

Related

Xcode's SceneKit editor renders .dae file's wrong and Xcode sometimes crashes during preview

I'm trying to figure out how to import .dae files with animations into Xcode and SceneKit.
It works somewhat, but it's really buggy, I can't preview files, and Xcode sometimes crashes when trying to preview the .dae files in Xcode.
Here's how I'm importing the animated models
I download an animated character from Mixamo, as a Collada file, with the settings below.
Create a brand new SceneKit iOS project, import .dae file, and select the file in the Xcode file list to preview it. The result can be seen below. I have zoomed all the way out to make sure I'm not just viewing the model from the inside of the mesh. The lines extend infinetly it looks like.
If I use the ConvertToXcodeCollada workflow, and verify that the .dae XML only has one <animation> tag with corresponding closing tag, and then import it into Xcode, it won't open at all. See image below.
If I import the .dae file version not converted using ConvertToXcodeCollada, and the add .dae file as a sub reference in a .scn Scene file, the model displays correctly, and the animation is playing correctly. Image below.
So how should I do this properly?
I have also tried to import animated models into Blender and then export it to Collada from there (with unstructions from tutorials on youtube), and same results. Is there a way I can do this a proper way, where it works like it should, without Xcode behaving buggy? It would be easier if I could actually preview and edit materials etc of the .dae files directly, without having to always add them to an existing .scn Scene Kit Scene.
I did followed your instructions and try to load a 3D animation. Its working fine for me
In new sceneKit project I have updated my code like.
// create a new scene
let scene = SCNScene(named: "Jumping.dae")! //"art.scnassets/ship.scn")!
and this too
let ship = scene.rootNode.childNode(withName: "mixamorig_Hips", recursively: true)! // "ship"
I am using XCode 10.1 on macOS 10.13.6
This happen when I try to open in finder a .dae file with animation created with mixamo
https://www.mixamo.com/#/
mojave OS 10.14.1
BUG Fixed by apple 10.14.2
I have downloaded which you mentioned above link. github.com/eh3rrera/ARKitAnimation
And I opened in finder. Its working for my mac

Assets cannot be found

Before xCode 9, when I wanted to create a UIImageView with an image, I would drag an image into the project side bar and create a UIImage with the name of that file. This worked and all was well.
However, with Xcode 9 this will not work. It won't be able to find that file, even though it's there in the main bundle. What I needed to do was to put the image into the Assets folder, and then it was able to find the image and show it in the UIImageView.
Likewise, when working with Sprite Kit, I would create a folder in my desktop with a .atlas extension, drag all my images into that, and then drag the .atlas folder in the project. Then I'd create a SKTextureAtlas with the name of the .atlas folder, and it worked. With Xcode 9 however, this again did not work. I would get a 'Texture Atlas 'foo' cannot be found' message in the console. So I went to the Assets folder, clicked the add icon and choose New Sprite Atlas, renamed that folder, and dragged my images into it. Now creating the texture atlas with that name worked.
What I'm now trying to do, and having trouble with, is creating an SKVideoNode using init(filedNamed: "foo.mov"), and as you guessed, this no longer works if you dragged the file into the project's side bar. So I thought maybe I again need to somehow do this through the Assets folder. I found that when I add my .mov file to the Assets folder, it gets created as a 'Data' type ('Data' shows in the top right corner of its box in the Assets folder). What I can do now is this:
let d = NSDataAsset(name: "foo") // 'foo' is the .mov file in Assets
d.data // the underlying content
Turns out d is not nil, which was good news, but the only way to access the underlying content is just by way of .data, and you cannot create an SKVideoNode with data. I also wanted to load a sound file, which I used to do like this:
let a = SKAction.playSoundFileNamed("bar.mp3", waitForCompletion: false)
But I get the message 'Error loading sound resource: "bar.mp3"'.
Check to see if your resources are being bundled.
Go into your project settings and click on the Build Phases tab, make sure your resources are in the copy bundle resources section
I had the same problem but my issue was I did not select "Create groups" when dragging a folder of sounds into XCode. That plus the "Copy items if needed" worked for me.

What's really happens when I create a "New Sprite Image" inside my Xcode images.xcassets?

Days ago I asked for How check the .spriteatlas sizes generated by Xcode? but I got no answer so I decided to slightly change my question:
What happens when I choose this option here inside the images.xcassets section?
Does Xcode provide a full atlas manager and I just have to add single images inside this folder or should I put inside a whole atlas (created by my self with the .plist file attached)?

Problems with .ccb file for sprite in SpriteBuilder

I am trying to understand SpriteBuilder. I made a new file hero.ccb for sprite and set it's sprite frame to the image I need. When I go back to the MainScene and drag hero.ccb from the left menu,there is just a CCBFile without anything(no sprite image). What am I doing wrong?
This can happen if you didn't save the hero.ccb. Choose File -> Save All or simply Publish the project to have SpriteBuilder update all references.

Xcode ignores Texture Atlas inside a subfolder

I have a case where I need to keep the folders hierarchy in my iOS app bundle, which contains some texture atlases. However, unlike the case with group referencing, Xcode seems to ignore any texture atlas under directory that's referenced as a folder not a group. Any workaround for this?
Have you tried renaming and adding the ".atlas" at the end of the folder's name, dragging it to your project again and keeping the following option ticked? copy items into des... Create groups for any ... add to targets (your project selected)
In Xcode it's not enough move your folder to the Assets.xcassets. You must go inside Assets and select AR and SceneKit > Sprite Atlas , rename the folder and move all your sprites inside it.
P.S. remember to remove your app from the simulator/device before to launch the corrected Assets.

Resources