How to use Xcode Framedebugger for Unity?

Hi guys, I want to do a graphic analysis of my game following the guidelines found here However, it really confused me when it said "To load the Xcode frame debugger, launch the Unity Editor through Xcode, with Metal selected as the GPU Frame Capture option."

So my question is how should we launch the Unity Editor through Xcode?

1 Like

i guess you need unity source code to doing that

The documentation is hilariously vague. It feels like it was written by an underpaid intern.


You can use the Xcode frame debugger to capture a frame of a complex scene
in your application, then identify bottlenecks in your shaders
. On devices with the A11 chip or later (iPhone 8 and newer devices), Xcode offers an even more detailed breakdown of shader timing. This allows you to analyze performance and debug vertex and fragment issues.

Please read the thread that you're replying to. No one is asking what the frame debugger is nor why it is used. What are the steps to hook it up with the Unity Editor?

same confusion.

haven't figured out how to launch Unity Editor from Xcode yet either

Has anyone figured this out yet? Can't figure it out either.

Ok, I got close, maybe this will help some people.

To launch Unity editor from Xcode:

  • Open Xcode
  • Select “Create a new Xcode project”
  • Under “Choose a template for your new project” select macOS -> Command Line Tool and press Next button.
  • Enter a Product Name (i.e. MacEditor) and any additional information. I selected C++ for language. Press Next, and save to a location on your computer.

Now that you're in your new project, select main.cpp and write a short script to open your specific project with Unity.
Here is an example, you can follow the general format using your specific Unity version and specific project path and name:
6029138--650546--Screen Shot 2020-06-27 at 1.28.15 AM.jpg

Press the play button at the top and it should open your project in the Unity editor!

Here is where I run into trouble. If I launch like this, I get the little person icons as expected:6029138--650552--XcodeCaptureButton.png
But when I press the button to capture a frame, it does not open the Xcode frame debugger. Nothing happens.

To be fair, at this point I haven't fully followed the instructions at the link at the beginning of this thread. I still need to change the scheme of the MacEditor target to select Metal as the GPU Frame Capture option (it defaults to Automatically Enabled). But when I do that and press play, Unity launches, but now the little person icons are no longer there so I can't even try to capture a frame. Wondering if that's a bug. I do have Metal Editor Support checked in Project Settings.

So I got close. If anyone wants to try out what I've got so far and see if they can get further, please keep us posted! I'll follow up if I have more luck.

1 Like

I think I found the way.

  1. Create a new command line project (I chose c++). 6038954--652526--Screen Shot 2020-06-30 at 8.30.06 AM.png
  2. Change the project's executable to be unity editor 6038954--652532--Screen Shot 2020-06-30 at 8.29.16 AM.png
  3. Change the arguments to add a project path to open 6038954--652535--Screen Shot 2020-06-30 at 8.29.49 AM.png
  4. Press play in xcode. The editor should now start and the frame debugger button should work.

Basically, the code in your xcode project doesn't matter. You're not using or even compiling it. You're just using xcode to start your project.

6038954--652526--Screen Shot 2020-06-30 at 8.30.06 AM.png


I felt hopeful this would work since I did get the xcode Frame Debugger icon after following the above instructions. However clicking the icon did nothing at all. :(. Xcode shows that Unity is running, so I know it's "connected" in some way. Icon appears in Unity... just doesn't do anything.

Mathieur solution works.

I was initially a bit confused about finding the right place to set executable and command line arguments in Xcode. Shortcut ⌘< helps there.

Unfortunately I'm not even seeing the frame debugger icon. This is with Unity 2021.2.19f1

EDIT::: I hadn't followed the step to "Enable Frame Capture" in the Xcode scheme - it is working now.