How can I debug Unity's Cache Server?


  • I do not know how to debug the cache server. 
  • Cache server runs in my local machine making it difficult to identify problems.


  • Multiple clients are running the cache server and are making it unresponsive.
  • You need to debug the cache server. 


The Cache Server is a set of javascript scripts, run using Node.js. There is a tool, which allows debugging Node.js scripts, called Node Inspector. To the debug the Cache Server with this tool, there are several steps to follow:

  1. Install Node.js: Get the latest build of Node.js here: Once Node.js is installed, it should be added to your "/usr/bin/" path. This will add the extra tools needed for debugging.
  2. Install the Node inspector: 'npm install -g node-inspector' (Run this through the terminal).   *MAC: If by any chance you get an error stating "This is most likely a problem with the v8-profiler package, not with npm itself. " a workaround for this is to write 'sudo npm install -g node-inspector --unsafe-perm'                          *WINDOWS: Your Node.js application should be stored in C:\Program Files\nodejs, thus using the Command Line write : cd C:\Program Files\nodejs npm install -g node-inspector. 
  3. Modify the script that launches Node.js to use "node-debug". This script can be found in the  folder where you stored the Cache Sever. On OS X, the script is "RunOSX.command", while on Linux it is "" and in Windows it is "RunWin.cmd". (See the images below).
  4. Replace this obsolete method in the cache server scripts (LegacyCacheServer.js and CacheServer.js) "path.existsSync --> fs.existsSync"
  5. Once you execute the script according to your platform, this will use "node-debug", which should launch Google Chrome and allow you to debug the Cache Server code. (You need to have Google Chrome installed).                                                      *WINDOWS: You have to do something different here. You need to execute the main.js script in the command prompt like this "node-debug C:...\CacheServer-5.3.0f4\CacheServer\main.js"






More Information

This article applies to Unity versions 5.x


Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.