Kevin H
Kevin H
Sep 6, 2018 · 1 min read

In the SwiftForUnity.cs file you import the swift functions and use them only when unity is in iOS build mode and not in editor (#if UNITY_IOS && !UNITY_EDITOR). This is there because Unity can’t compile Swift code so it doesn’t know what to do with it. That’s why we define alternitive functions in the SwiftForUnity class so that it won’t break in the editor, but you won’t be able to debug the Swift code in the Unity editor, you should however be able to debug on an Xcode iOS simulator.

    Kevin H

    Written by

    Kevin H