我想为障碍图添加一个障碍,有趣的是它给了我一个运行时错误。有什么东西我可能会丢失或做这导致错误?
游乐场代码
import GameplayKit
let graph = GKObstacleGraph()
let barrier = GKPolygonObstacle(points: [
float2(x: 200, y: 200),
float2(x: 500, y: 200)
])
graph.addObstacles([barrier]) // error: Playground execution aborted: error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x20).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.