Debugging Resource Compiler in Xcode

The Asset Processor on my Mac was failing to compile some FBXs and I wanted to find out what might be going on a bit more than the error logs were showing me. I would need to debug the Resource Compiler (RC), since it is the app responsible for converting ABC (Alembic file), CGF (Legacy geometry format), I_CAF (Legacy animation format), TIF, BMP, JPG, PNG (Image files), and FBX (static mesh). Debugging RC in Xcode requires some extra steps…

When you open your Solution/LumberyardSDK Xcode product you’ll notice a scheme called “ResourceCompiler”, this is NOT the one you want to run! Instead…

Create a New Scheme

  1. Xcode Product > Scheme > Edit Scheme

  2. Select “Resource Compiler” from the drop list of available Schemes

  3. Press “Duplicate Scheme” and rename this one something catchy, like… “Real Resource Compiler”

  4. Under Run’s “Info” tab, change the Executable. Point the Executable field to your BinMac64*/rc/

  5. You can now place a breakpoint inside ResourceCompiler.cpp RCMain() and run using the new scheme

Note: Just like when debugging RC on Windows, you’ll need to pass in command line arguments to tell RC which file you want to compile. To do this on Mac, open up your “Real Resource Compiler” scheme for edit (Product > Scheme > Edit Scheme). Go to Run’s “Arguments” tab and add a new entry for “Arguments Passed on Launch”. Use the Asset Processor (AP) to find the command used for the failed asset. Inside of AP double click on the failed asset and the log output window will appear. If this asset is being compiled with RC, the first log under the “All Output” tab will contain the command line arguments.

Example Output seen in Asset Processor:

Executing RC.EXE: ‘"/Users/gfunc/Path/To/Project/BinMac64//rc/rc" “/Users/gfunc/Path/To/Project/MyGame/Models/new_props/clutterLeavesGreen10.fbx” /p=ios /unattended=true /gameroot="/Users/gfunc/Path/To/Project/MyGame" /watchfolder="/Users/gfunc/Path/To/Project/MyGame" /targetroot="/Users/gfunc/Path/To/Project/AssetProcessorTemp/JobTemp-vhabAY" /logprefix="/Users/gfunc/Path/To/Project/AssetProcessorTemp/JobTemp-vhabAY/" /port=45643 /gamesubdirectory=“MyGame” /branchtoken=“0xD7B39334”’ …

Strip output to just the command line:

“/Users/gfunc/Path/To/Project/MyGame/Models/new_props/clutterLeavesGreen10.fbx” /p=ios /unattended=true /gameroot="/Users/gfunc/Path/To/Project/MyGame" /watchfolder="/Users/gfunc/Path/To/Project/MyGame" /targetroot="/Users/gfunc/Path/To/Project/AssetProcessorTemp/JobTemp-vhabAY" /logprefix="/Users/gfunc/Path/To/Project/AssetProcessorTemp/JobTemp-vhabAY/" /port=45643 /gamesubdirectory=“MyGame” /branchtoken=“0xD7B39334”