Search Unity

How to use EditorConnection and PlayerConnection for custom diagnostic feature?

Discussion in 'Scripting' started by Kichang-Kim, Oct 17, 2018.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,011
    Hi. I found that Unity have editor-player communication API: EditorConnection and PlayerConnection but there is no documents for its actual usage.

    That APIs has no Connect() method and only have passive events (OnConnection, OnMessage, and so on). After some testing, I found that connecting to device in Profiler window triggers EditorConnection.OnConnection.

    So, here is my questions:

    1. To establish connection between Editor and Player, only way is starting normal Profiling in Profiler window. Is this true? (or any other method for making "Connect" button in my UI?)

    2. Both EditorConnection and PlayerConnection has no unregister method for OnConnection and OnDisconnection handler. So, should it be okay that calling RegisterConnection and RegisterDisconnection wihtout unregistering? (It seems to be okay because other Unity's package, ex Addressables uses same way.)

    Thanks.
     
    MihaPro_CarX likes this.