Search Unity

  1. Unity 2019.4 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  3. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

How to use Xcode Framedebugger for Unity?

Discussion in 'External Tools' started by GuardHei, Dec 10, 2019.

  1. GuardHei

    GuardHei

    Joined:
    Feb 10, 2018
    Posts:
    63
    Hi guys, I want to do a graphic analysis of my game following the guidelines found here https://docs.unity3d.com/Manual/XcodeFrameDebuggerIntegration.html. 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?
     
    Last edited: Apr 9, 2020
    eclmist likes this.
  2. friuns

    friuns

    Joined:
    Jan 14, 2016
    Posts:
    23
    i guess you need unity source code to doing that
     
  3. eclmist

    eclmist

    Joined:
    Oct 25, 2016
    Posts:
    7
    The documentation is hilariously vague. It feels like it was written by an underpaid intern.
     
    owenoury likes this.
  4. Halcomb

    Halcomb

    Joined:
    Jan 23, 2020
    Posts:
    3
    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.
     
  5. eclmist

    eclmist

    Joined:
    Oct 25, 2016
    Posts:
    7
    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?
     
  6. wanzhang

    wanzhang

    Joined:
    May 19, 2015
    Posts:
    8
    same confusion.
     
  7. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    383
    haven't figured out how to launch Unity Editor from Xcode yet either
     
  8. dcolman

    dcolman

    Joined:
    May 21, 2017
    Posts:
    7
    Has anyone figured this out yet? Can't figure it out either.
     
  9. dcolman

    dcolman

    Joined:
    May 21, 2017
    Posts:
    7
    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:
    Screen Shot 2020-06-27 at 1.28.15 AM.png

    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: 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.
     
    chrismarch likes this.
  10. mathieur

    mathieur

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    30
    I think I found the way.

    1. Create a new command line project (I chose c++).
    Screen Shot 2020-06-30 at 8.30.06 AM.png
    2. Change the project's executable to be unity editor
    Screen Shot 2020-06-30 at 8.29.16 AM.png
    3. Change the arguments to add a project path to open
    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.
     

    Attached Files:

    chrismarch likes this.
unityunity