CUDLR

If you have already covered a couple of chapters in this book, you may be familiar with CUDLR, which is an excellent remote logging, debugging, and inspection tool. For those of you that missed the CUDLR setup in Chapter 2, Mapping the Player's Location, no worries, as we will do a review of the setup here. Of course, if you are here because of issues with CUDLR, refer to the final section in this chapter, Issues and Solutions by Chapter.

CUDLR is a remote console that runs through an internal web server created within your game. It uses the same technique we used to output the log output, but it also provides for object inspection and even customization. Use the following instructions to set up CUDLR (if you have already done this, you may want to just skim over this section):

  1. If you have not already set up the Chapter 10 project, then open a new Unity project and import Chapter10.unitypackage from the Chapter_10_Assets folder of the books downloaded source code.
  2. Open the Main scene from the Assets/Chapter 10/Scenes folder.

    Tip

    CUDLR has been included as a part of the Chapter10 package.

  3. From the menu, select GameObject | Create Empty. Rename the object CUDLR and reset its transform to zero.
  4. Drag the Server script from the Assets/CUDLR/Scripts folder in the Project window onto the new CUDLR GameObject.
  5. By default, CUDLR sets itself to run on port 55055. This setting can be changed by inspecting the CUDLR GameObject in the Inspector window. For now though, leave it at the default value.
  6. Press Play in the editor to run the scene. Keep the scene running.
  7. Open the browser of your choice and enter the following URL: http://localhost:550555
  8. The CUDLR window will open in the browser, as shown in the following screenshot:

    CUDLR

    CUDLR window in a browser (Chrome)

  9. At the bottom of the window, enter the following command:
    help
    
  10. This will provide the following output:
    Commands:
    object list : lists all the game objects in the scene
    object print : lists properties of the object
    clear : clears console output
    help : prints commands
    
  11. Enter the following command:
    object list
    
  12. This gives the following output:
    CUDLR
    Directional Light
    Cube
    Main Camera
    
  13. Enter the following command:
    object print Cube
    
  14. This gives the following output:
        Game Object : Cube 
          Component : UnityEngine.Transform 
          Component : UnityEngine.MeshFilter 
          Component : UnityEngine.BoxCollider 
          Component : UnityEngine.MeshRenderer 
          Component : RotateObject 
    

As we have shown in several sections of this book, CUDLR is also useful for capturing logging activity on a game running on a mobile device. With CUDLR, you could simultaneously track logging output on several devices at the same time. Of course, CUDLR is really only intended for capturing logs while debugging or testing. The internal web server CUDLR creates is not something we would want to ship with our game for numerous reasons.

What if we want to track critical error or exception logs after our game is released? Fortunately, there are a number of options available to do that in Unity and we will look at one of these options in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.219.166