'Where's the particle system file in SceneKit in Xcode 11.3.1

Recently I updated my Xcode to 11.3.1. But while working with SceneKit, I found that I can't create a particle system file.

  • Before

Before

  • After

After

How can I create a particle system in a file now?



Solution 1:[1]

SceneKit Library

In Xcode 13 / 12 / 11 you have no preconfigured .scnp particle system files anymore. Instead, you can use a Particle System object coming from a Xcode Library (with the same settings in Attributes Inspector as they were in Xcode 10).

enter image description here

If you manually placed a Particle System from library into SceneKit's Scene graph you can then retrieve it and setup programmatically. Let's see how it looks like:

let particlesNode = sceneView.scene?.rootNode.childNode(withName: "particles", 
                                                     recursively: true)

particlesNode?.particleSystems?.first?.isAffectedByGravity = true
particlesNode?.particleSystems?.first?.acceleration.z = 5.0


Creating particles programmatically

Or you can easily create a Particle System from scratch using just code:

let particleSystem = SCNParticleSystem()
    
particleSystem.birthRate = 1000
particleSystem.particleSize = 1.45
particleSystem.particleLifeSpan = 2
particleSystem.particleColor = .yellow

let particlesNode = SCNNode()
particlesNode.addParticleSystem(particleSystem)

sceneView.scene!.rootNode.addChildNode(particlesNode)

Creating .scnz file containing Particle System

  • Select a .scn file in Project Navigator (left pane) and choose File – Export...
  • In drop-down menu choose Compressed Scenekit Scene Document .scnz

enter image description here

Or you can create .scnp file by renaming .scn – the same way @ycao proposed.

Solution 2:[2]

Particle System moved to Scene Kit Scene File as a library object:

Particle System in Library

Solution 3:[3]

While creating a new file, select SceneKit SceneFile. Edit the suffix to .scnp, and everything is OK.

Solution 4:[4]

You can also right click inside the scene graph viewport Create > ParticleSystem then adjust the settings as per usual in the properties inspector. Then do the usual stuff as mentioned above in code to retrieve the system, move about, change settings etc.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Vladislav Kulikov
Solution 3
Solution 4 JeremyRaven