GKAgent not delegating

Hello,


I try to build a new game with IOS9 + GameplayKit + SpriteKit.


I got an Entity -> Agent -> Behavior and the agent is delegating to a class called CarBot.


I never get the "agentWillUpdate", "agentDidUpdate" in CarBot class when I do the updateWithDeltaTime from the scene.update()


        for componentSystem in componentSystems {
            componentSystem.updateWithDeltaTime(deltaTime)
        }


When I add the code in CarAgent :


    override func updateWithDeltaTime(deltaTime: NSTimeInterval) {
        super.updateWithDeltaTime(deltaTime)
    }


I got once the AgentWillUpdate() triggered and then an error on the line 03.


CarAgent delegate to the CarNode() of course and in my scene, i call the updatewithDeltaTime in the Update() method of the scene.


Any clue ?


thank you.

Answered by hciaravolo in 13606022

Hello Brian,


The code is spread all over different classes. It is very similar to what you can see in DemoBots. I would post the entire project, which I don't want of course.


The issue appears only in the simulator, not on a real device. I will probably file a bug for this.


Thank you for your feedback.

ok, small updatE.


I changed the ComponentSystem to a single component (CarAgent class - GKAgent2D) and changed the code accordingly.


I still have the same issue : when I trigger the "updateWithDeltaTime", I got the "AgentWillUpdate() trigerred and then the error on the line "updateWithDeltaTime".


I cannot figure out where is the problem and It look like I'm the only one on earth to use this new feature :-)

Another update :-)


It works on a physical device. So It's linked to the simulator.

It would be helpful if you posted the rest of your code. It is difficult to tell what the issue is based on the few lines you've provided.

Accepted Answer

Hello Brian,


The code is spread all over different classes. It is very similar to what you can see in DemoBots. I would post the entire project, which I don't want of course.


The issue appears only in the simulator, not on a real device. I will probably file a bug for this.


Thank you for your feedback.

GKAgent not delegating
 
 
Q