Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity windows system tray NotifyIcon (winforms)

Discussion in 'Editor & General Support' started by Luchunpen_0, Jul 22, 2021.

  1. Luchunpen_0

    Luchunpen_0

    Joined:
    Aug 7, 2014
    Posts:
    58
    Hi guys !

    1. I'm developing an application with asynchronous requests (UnityWebRequests.SendRequest) with await Task.Delay() and want to add windows NotifyIcon in system tray.
    2. I found this source to make app system tray icon using WinForms.dll. https://www.programmersought.com/article/23467662017/

    The problem is: this realization blocks my requests when I use Task.Delay().

    3. So I found another source with separate winforms application and this guy uses [STAThread] and Mutex in his winforms solution http://www.laowangomg.com/?p=496 , but I don't want to run an external process (honestly I haven't tested if this solution works)

    I understand that I need some kind of additional threads synchronization.
    I know about threads not much, so who can explain how to avoid this without big changing in application logic ?
    Maybe there is a ready-made solution (I haven't found any in asset store)??

    Thanks.
     
    Last edited: Jul 22, 2021
  2. AdamLiu

    AdamLiu

    Joined:
    Mar 19, 2014
    Posts:
    71
    Did you manage to solve this?