Wayne
Wayne

Reputation: 77

GCVirtualController triggers didMove twice

New iOS person here..

Trying to incorporate GCVirtualController into my test code.

When I do, I see didMove getting called twice, thus causing lots of down-stream problems. As soon as I comment out the controller, it only calls didMove once.

        let controllerConfig = GCVirtualController.Configuration()
        controllerConfig.elements = [ GCInputDirectionPad ]

        let controller = GCVirtualController(configuration: controllerConfig)
        controller.connect()
        virtualController = controller
        let movementHandler: GCControllerDirectionPadValueChangedHandler = { dPad, xValue, yValue in
            self.movePlayer(x: xValue, y: yValue)
        }

        if let gamePad = virtualController?.controller?.extendedGamepad {
            gamePad.dpad.valueChangedHandler = movementHandler
        }

Also found that if I do not define any valueChangedHandler, then it just seems call didMove over, and over.

Not seeing much when I google for GCVirtualController examples.

I tried changing around start up order, ect. Nothing helped

Upvotes: 0

Views: 26

Answers (0)

Related Questions