I came across this problem when trying to create custom swift files with SwiftUI for my project in Hybrid Mode, and Unity could not build with the following error:
BuildFailedException: File Libraries/ARM64/Assets/SwiftAppSupport/SwiftUISaveLoadInjectedScene.swift is expected to be in the generated Xcode project, but it is missing.
I might be understanding the documentation provided wrongly but I have tried naming all swiftUI files to …IntectedScene.swift and even place all Swift code in SwiftAppSupport folder but it still doesn’t work.
After digging around the code, it seems like all the custom swift files does not get copied to the build directory while building, and SwiftAppShellProcessor.cs failed to find these files when MoveProjectFileToTarget() method is called. My current convoluted solution is to modify SwiftAppShellProcessor.cs to copy the files to the correct directory and add them into the project before MoveProjectFileToTarget() is called. Is this a bug or am I doing something wrong since my project have both the Polyspatial samples and my own code which sits outside the Samples folder, but the sample scenes are not in the scene list when building?
Is there another way to circumvent this problem, since my current solution will disappear every time a new version of Polyspatial is available?
