Xcode Error in Scene Editor and Entity/Component Architecture

Hello, I'm writing to report an issue (or a documentation error).

I am using the Entity/Component Architecture incorporated in the GamePlayKit framework. Additionally, I want to take advantage of the user interface provided by the Scene Editor. This is essential for me if I want to involve more people in the project.

The issue occurs when linking the user interface data with the GKScene of the aforementioned framework.

The first issue arises when adding a component through the interface as shown in the image

Then at that moment:

if let scene = GKScene(fileNamed: "GameScene") {
    
    // Get the SKScene from the loaded GKScene
    if let sceneNode = scene.rootNode as! GameScene? {

Scene.rootNode is nil, and the scene is not presented.

However, I can work around this issue by initializing the scene separately:

if let scene = GKScene(fileNamed: "GameScene") {
    
    // Get the SKScene loaded separately
    if let sceneNode = SKScene(fileNamed: "GameScene") as! GameScene? {

But from here, two issues arise:

The node contains a component, and the scene has been loaded separately

  1. When trying to access a specific entity through its SKSpriteNode:
self.node?.entity // Is nil

It becomes very difficult to access a specific entity. When adding a component, an entity is automatically created. This is demonstrated here:

The node contains a component, and the scene has been loaded separately.

I only have one way to access this entity, and since there is only one, it's easy:

sceneNode.entities[0]
  1. But even so, it's not very useful because when I try to access its components, it turns out they don't exist.

I just wanted to mention this because it would be very helpful for me if this issue could be resolved.

Thank you very much in advance.

Xcode Error in Scene Editor and Entity/Component Architecture
 
 
Q