- Home /
Duplicate interface definition for class 'CAMetalLayer' : unity to Xcode simulator
building for iOS 13 attempting to use the Xcode simulator for iPhone 11/pro/pro max.
unity version: 2018.3.14f1 personal. when running in Xcode I get the following error(s):
Answer by LiamColee · Feb 06, 2020 at 11:53 AM
Hey, if anyone wants to fix this issue and doesn't want to install new software and doesn't feel comfortable deleting the problem code. just add a conditional around it that is the same as the conditional above it (#if UNITY_CAN_USE_METAL). this fixed the issue for me
EDIT: you may run into some void* issues. just copy what it says it should be and past it in place of the void*
Answer by GrayLightGames · Dec 10, 2019 at 11:51 PM
If you're like me and don't want to rearrange your Unity/Xcode installations, I was able to deploy to the simulator by just removing the problem CAMetalLayer code in Xcode. There is another error that pops up after that, just removed the code causing the problem there as well. Might not work if your code relies on CAMetalLayer, whatever that is :) My 2D game apparently does not. Or it really is just a duplicate definition, so removing has no impact.
Not the most elegant and surely not the best solution, but doesn't require any updating of your software.
Answer by schwips · Oct 20, 2019 at 04:23 PM
I have the same problem and I don't want to go back to xcode 9 or 10. Any solutions?
Would you $$anonymous$$d sharing the version you upgraded to that fixed this issue?
Answer by DonnaAG · Oct 15, 2019 at 09:13 AM
I had the same thing happening when I went from Unity to iOS. I fixed it by specifying in Unity build settings a version of Xcode prior to Xcode 11. For some reason I get this same error if I run in Xcode 11, but not if I run in Xcode 9 (I'm sure Xcode 10 will work too).
Also hit this problem with 2018.3.14f1. Can confirm that downloading and opening with Xcode 10 (all $$anonymous$$or versions) fixes this problem.
Note that in order to get rid of the project error, you'll have to rebuild the project from Xcode.
Does anyone know if this is fixed in any of the LTS Release versions for Unity? Unfortunately I'd have to port my runtime to .NET 4 in order to move up to the next LTS Release, but I don't want to invest that time unless I know I can get around this problem.
Answer by umair_hassan1991 · Jan 27, 2020 at 10:45 AM
Is there any workaround from Unity, that I can fix this issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220612213223im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to move a GameObject into scene 1 Answer
Vuforia 4.2.3 + U5.0.2f1 + Xcode 6.3.x iOS can't code sign 2 Answers
Turn on iPhone torch using ARKit 1 Answer
Issue with vuforia and unity 2019.3.5 0 Answers