Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[HELP] Debugging

Discussion in 'Project Tiny' started by vincismurf, Jan 6, 2019.

  1. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    What is the best way to debug Tiny? What does the Debug mode in the Tiny Build Settings do?

    I have ran across a few instances where I destroy an entity group and later re instantiate it and it appears that the values from the last instance of the EntityGroup persist. Normally I would set a breakpoint and step thru the debugger looking at the call stack and watched variables but I don't seem to know how to set that up for Tiny and TypeScript.

    Could someone point me in the right direction?
     
  2. raymondyunity

    raymondyunity

    Unity Technologies

    Joined:
    Apr 30, 2018
    Posts:
    122
    The best way to debug your Tiny project is with web debugging practices. You can add breakpoints in developer mode If you are unfamiliar with that then this guide can help you get started: https://developers.google.com/web/tools/chrome-devtools/javascript/. Chrome and Firefox are very similar when it comes to debugging.

    You would probably want to inspect and add breakpoints in your code which will be located in a "tsc-emit.js" file. You can even go as far as diving into the "assets.js" and "entities.js" files where assets and entities are initialized.

    When you have "Tiny > Enable Play Mode" menu item active and you click play while in a Development build you will enter Live-Link mode. This will allow you to inspect your entities directly in Unity when you press the Pause button. Please note that the Live-Link mode is a work in progress and far from being fully featured (it is not even documented yet).

    Last but not least, console.log outputs.

    Tiny build settings summary:
    Debug: This contains no optimizations but includes debug information (call stack, etc.). This is really meant for internal developers.
    Development: This contains optimizations and debug information. Use this whenever you are not planning on publishing your project.
    Release: Use this when you are building your project and ready to publish it. This contains optimizations but no debug information.
     
    vincismurf likes this.
  3. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    Thank one minor follow up . . . when I try to debug with VSCode it complains about a missing "node". . . . could you provide any tips for attaching VSCode to the Tiny Unity build?
     
  4. raymondyunity

    raymondyunity

    Unity Technologies

    Joined:
    Apr 30, 2018
    Posts:
    122
    Don't attach it. We're not supporting that sort of "web app debugging" setup right now.
     
    frankprogrammer and vincismurf like this.
  5. ronblockparty

    ronblockparty

    Joined:
    Oct 13, 2018
    Posts:
    6
    This is a pretty big deal that I wish I'd discovered a little sooner. Has any thought been given to documenting the ability to inspect the entity hierarchy and component values in the editor, even if full support isn't yet implemented? This had been one of the biggest inhibitors to my productivity until reading this. I imagine many other developers could benefit from this as well.

    Thanks for all your support on this!
     
    abeisgreat and SzabolcsNagy like this.
  6. raymondyunity

    raymondyunity

    Unity Technologies

    Joined:
    Apr 30, 2018
    Posts:
    122
    Thanks @ronblockparty for the feedback. I will place the info in the FAQs.
     
    ronblockparty and vincismurf like this.
  7. Zoelovezle

    Zoelovezle

    Joined:
    Aug 7, 2015
    Posts:
    54
    @raymondyunity I have Play mode enabled as well i am in development mode . Yet i can't see entities loading in hirarchy . Is there some step i am missing ?
    Screen shot in Play mode :
    https://imgur.com/a/PR2swTW
     
  8. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    You have to do debugging in the browser!
     
  9. raymondyunity

    raymondyunity

    Unity Technologies

    Joined:
    Apr 30, 2018
    Posts:
    122
    You have to press "Pause" to enable Live-Link.
     
  10. Zoelovezle

    Zoelovezle

    Joined:
    Aug 7, 2015
    Posts:
    54
    @vincismurf Yes right , but @raymondyunity also mentioned that we could inspect entities directly in playmode within unity ..

    So technically on mac i create two windows . One window i my chrome is open and other unity as a fullscreen and i swipe between to work .
    After realization , unity and chrome should be on same window or live link doesn't updates or say stops. I guess this could be with the javascript code stopping from running when we switch windows , because whenever i load the game , game state is paused when i switch to other windows.
     
    Last edited: Feb 12, 2019
  11. raymondyunity

    raymondyunity

    Unity Technologies

    Joined:
    Apr 30, 2018
    Posts:
    122
    During Pause mode on Live-Link, you will see an information dump of all of the Entities of the world state back in the editor. I have more success debugging the web way but you can certainly try to use the unfinished Live-Link mode to help with certain problems. Because Live-Link increases iteration time, I tend to keep it off. It is also known to not work as expected with a large world (like the TinyArms demo).
     
  12. Zoelovezle

    Zoelovezle

    Joined:
    Aug 7, 2015
    Posts:
    54
    Thanks had it working few mins ago after getting unity and browser(chrome) on same window . Apparently there's a pretty bad bug which i am trying to figure out , i might create new post if its not related to my scripts .
     
    raymondyunity likes this.
  13. mm1982

    mm1982

    Joined:
    Apr 28, 2015
    Posts:
    35
    Has the "Tiny -> Enable Play Mode" option been removed? I don't find those project settings anywhere, Im using the latest Tiny package 0.16