How to build and debug with Xcode?

I’m trying to learn how to use UE 4 and I have read and gone through everything I can find but haven’t found an answer.

Lets say I create a new C++ project from one of the templates. Like the Flying example. How can I then build this game project in Xcode, set stop points for the debugger and all the usual things I would normally do with a project in Xcode?
Surely there must be a way to debug a UE4 game project?

Check out these instructions and see if they help you:

I have seen that page but I find it a bit confusing. The Xcode project has a number of different targets. Which one am I supposed to build? I now created a new project from a C++ template and in Xcode the default target is then MyProject iOS. So I change it to MyProject Mac and build it. The target builds ok. Then I try to run it and I get an error message saying “Could not launch MyProject-Mac-Debug”. Maybe there’s a bug in UE here since the built game binary is named “MyProject-Mac-DebugGame” but it’s looking for “MyProject-Mac-Debug”?

So I renamed the binary to “MyProject-Mac-Debug” and tried running from Xcode again. Now it starts running but then it complains about content not being cooked. It suggests I run the non cooked version but I have no idea how to do that or where or which version that might be. What does “cooking” mean in UE4?

I select “Cook Content for Mac” in the editor menu and then try to run from Xcode again. This time it launches properly and the game runs. Setting a break point in Xcode also works. Yay! :slight_smile:

So I guess the problem is that it must be a bug with the naming of the built binary since it’s naming it one thing but then looks for another name during launch?

You should be able to run with uncooked content as long as you add a command line argument “-game” when you launch it.

See this section from that page:

Changing the binary name sounds really iffy, although - apparently some other people have had this exact problem:

So it could just be a bug in the project configuration generation. You might want to bump that question (or start a new one) in AnswerHub so Epic is aware and can provide guidance.

I added a comment to the one in AnswerHub. Hopefully Epic will fix this, meanwhile I’ll see if I can find the script that creates the Xcode project and make the change for my own install.

Where do I add that flag?

I know this post is from long ago but 4.19.2 on an iMac running Xcode still runs into these issues.

I’ve been to the Epic docs and on the forums and I still can’t find a setup procedure that works so that I can get past Epic’s Twin Stick Shooter tutorial Episode 5.

There are a lot of ways for things to get screwy and there are a variety of methods to make things work like deleting the Intermediate folders, generating files, verifying the editor, etc. but there isn’t a simple series of steps to install it and make it run. Visual Studio has some semblance of this for the PC, where is the clear and complete method for Xcode?