8 Replies
      Latest reply on Jan 22, 2020 2:30 PM by ViktorEvil
      kemalenver Level 1 Level 1 (0 points)

        Looks like the particle system for scenekit is not available as a template anymore in xcode 11.  I can only see the SpriteKit version.  Is this by design or a mistake, or is there another way to create one?

        • Re: SceneKit particle template xcode 11
          KMT Level 9 Level 9 (15,495 points)

          Might want to let Xcode create for you.


          This from the docs may explain why it's gone missing (emphasis mine) while still being supported (don't forget to add the SceneKit frwmework)...


          Use the Xcode Particle System Editor to Experiment with Particle Systems

          In most cases, you don’t need to configure a particle system directly in your app or game. Instead, you use Xcode to configure a particle system’s properties. As you change the behavior of the particle system, Xcode immediately provides an updated visual effect. When complete, Xcode archives the configured system into a file, which you can then include with your project’s bundle resources. Then, at runtime, your game uses this archive to instantiate a new particle system.


          Using Xcode to create your particle systems has a few important advantages:

          • You can easily learn the capabilities of the particle system class.
          • You can experiment quickly with new particle effects and see the results immediately.
          • You separate the task of designing a particle effect from the programming task of using it. Your artists can work on new particle effects independent of your game code.
          • You can attach a particle system to a node in the Xcode scene editor to preview the particle system in your scene.


          To load a particle system from a file you created with Xcode, use the init(named:inDirectory:) method.

            • Re: SceneKit particle template xcode 11
              TheAutumn Level 1 Level 1 (0 points)

              The problem is that they didn't really point developers in a good way to go from here that I can find. I can't find notes about removing the template in the xcode change files and the documentation points to how to init a particle file in objective C, which isn't awesome (although manageable).

              Even when you check out their fox2 demo they released at wwdc 2017 to showcase their changes in scenekit, they used several scnp files within that project, and even the more recent swiftshot demo has at least one scnp file. I'm probably missing something but its frustrating.

              • Re: SceneKit particle template xcode 11
                kemalenver Level 1 Level 1 (0 points)

                Thanks KMT, totally missed that bit of the documentation, but I can't find anywhere that explains how to let xcode create the file for me.  Previously there was the template option, but there doesn't seem to be another way to create a particle system now other than with code. (Currently I can just copy an old scnp file I have lying around)

                  • Re: SceneKit particle template xcode 11
                    tnydwrds Level 1 Level 1 (0 points)

                    Just ran into this problem as well. I didn't have an old file available, so based on this information:

                    A SceneKit particle file created by Xcode contains an archived SCNParticleSystem instance, so you can also use the NSKeyedArchiver and NSKeyedUnarchiver classes to write and read particle files.

                    I just created my particle system in a .scn file on a single node in the file. Then wrote a Swift script to extract and archive the attached particle system as a .scnp file.


                    I guess since once you have a .scnp file it can still be edited in Xcode you could really just instantiate a default SCNParticleSystem and archive that as a reusable template.

                    • Re: SceneKit particle template xcode 11
                      ViktorEvil Level 1 Level 1 (0 points)
                      func createTrail(color: UIColor, geometry: SCNGeometry) -> SCNParticleSystem { 
                           let scene = SCNScene(named: "GeometryFighter.scnassets/Scenes/Trail.scn")
                           let node:SCNNode = (scene?.rootNode.childNode(withName: "Trail", recursively: true)!)!
                           let particleSystem:SCNParticleSystem = (node.particleSystems?.first)!
                           particleSystem.particleColor = color
                           particleSystem.emitterShape = geometry
                           return particleSystem }


                      i used the above to solve a tutorial in a RayWenderlich book


                      created a particle emitter in a blank scene then extracted the SCNParticleSystem

                  • Re: SceneKit particle template xcode 11
                    XanderXu Level 1 Level 1 (0 points)

                    Particle System : In .scn file, click "+" button in top right corner, you'll see it just between "Field" and "Action"