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
  4. Dismiss Notice

[Released] Stream Deck Integration

Discussion in 'Assets and Asset Store' started by Adam_Carballo, Oct 6, 2020.

  1. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    Regarding Unity, yes, all the way to Unity 2022 LTS is currently supported / tested, but I don't see any reason for the support to not extend further in the future without much issues

    Regarding the StreamDeck+, it is supported, but dials are not. Support for dial actions is coming this week / next week.
     
    skeegee123 and adiuva like this.
  2. skeegee123

    skeegee123

    Joined:
    Aug 30, 2021
    Posts:
    4
    Thank you, Adam. I appreciate the quick and informative response :)
     
  3. skeegee123

    skeegee123

    Joined:
    Aug 30, 2021
    Posts:
    4
    Hi, I've got another question. The asset has now been purchased, and I am wondering if there is a way to reset a SetProperty action's Value or even send back what the value should be? This would greatly increase the usefulness in my use case, since I need to control a value at runtime and need it to be set by my Unity program in the case of certain user-triggered events. Alternatively, is there a way to disable the displaying of the current Value? If that were possible, I am sure I could find a workaround for now. Thanks!

    P.S. This is specifically regarding the new dial actions.
     
  4. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    So sorry for the extreme delay, I didn't get any notification on your message

    Bi-lateral setting of values will come with the update to support dials. There have been some major delays with verification due to some personal reasons, I hope I can push it forward soon. - Alternatively, if you can contact me at support@f10.dev with your receipt I can provide you the pre-release version if you want to give it a try.

    Regarding hiding values, this is part of the action itself and it's not something that can be modified after the plugin has been compiled. But, since setting the parameter will be a supported action I think this wouldn't be required then, right?
     
  5. skeegee123

    skeegee123

    Joined:
    Aug 30, 2021
    Posts:
    4
    The delay was not a problem at all, I was on holiday anyways. Do you have a rough ETA for the update, or is it too hard to say at the moment?
    Regarding value hiding, if I can set the value, this would not be required in my use case.
    Thank you!
     
  6. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    An official update, as in, released on the store may take a bit, as Unity review times are a bit all over the place. I'm hoping for early next week
     
  7. adiuva

    adiuva

    Joined:
    Jan 21, 2017
    Posts:
    2
    I just got an email that the update was released, which reminded me of this thread :)

    Did you get a chance to look into this Adam?
     
  8. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    Hey there, yes, I've been looking into it and I have a tiny update about it :)

    The current update adds a bunch of functionality required to make this setup work, including the new "Scripted Action" which essentially allows Unity to completely define actions directly by code, without any configuration exposed in the Stream Deck software, but this still requires the end user to write an ID for that action that matches yours internally.

    This update took quite some time because of personal reasons but also because of the new dials hardware support for the Stream Deck +, but I'm starting a minor update soon with this feature as one of the main changes :)

    I'm still not 100% sure it will work as we want it, but with this update now Unity can send quite a lot of data back to the SDK which was not possible before, so it's one obstacle less
     
  9. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    Update v1.2.0

    This version brings support for the new Stream Deck + and its dial controls. It also adds scripted actions and button value settings among many fixes and quality-of-life improvements.

    Added
    • Added
      Stream Deck +
      and dials support.
    • Added
      StreamDeckDialAttribute
      attribute.
    • Added
      StreamDeckDialAction
      enum.
    • Added Scripted Action support.
    • Added
      Disconnect
      menu option.
    • Added device name reporting.
    • Added
      StreamDeckSettings.SetScriptedButton
      method.
    • Added
      StreamDeckSettings.RemoveScriptedButton
      method.
    • Added
      StreamDeckSettings.SetButtonValue
      method.
    • Added
      StreamDeckExample.ExampleScripted
      example method.
    • Added
      StreamDeckExample.ExampleDial
      example method.
    • Added
      MeansImplicitUse
      attribute to
      StreamDeckButton
      and
      StreamDeckGroup
      .
    • Added
      JsonData.AsDouble
      parsing support.
    Changed
    • Updated base Unity version to
      2019.4.40f1
      .
    • Increased
      JsonData.AsBool
      parsing support for
      t
      ,
      1
      ,
      yes
      as true.
    • Cleaned up logging messages to increase clarity.
    Fixed
    • Fixed
      JsonParser
      not working correctly on sub-nested JSON.
    • Fixed
      StreamDeckSocket.Disconnect
      method not working correctly.
    • Fixed unhandled exceptions from unconfigured actions.
     
  10. pilkycrc

    pilkycrc

    Joined:
    Mar 28, 2014
    Posts:
    3
    Hi, I've been using the Stream Deck Unity plugin for a while to talk to talk to a Unity stream overlay I've built. Unfortunately I found that today it had stopped working. Initially I thought this was because the plugin had updated but I hadn't updated the Unity side. Instead it seems that the Stream Deck plugin keeps failing to open.

    There don't seem to be any specific crash logs for the plugin showing up but I am getting the following from the StreamDeck log file:


    13:34:47.9067 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:34:47.9069 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 0 seconds(s)
    13:34:48.6375 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:34:48.6376 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 60 seconds(s)
    13:35:48.9091 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:35:48.9092 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 0 seconds(s)
    13:35:49.6484 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:35:49.6485 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 60 seconds(s)
    13:36:50.9534 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:36:50.9536 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 0 seconds(s)
    13:36:51.6733 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:36:51.6735 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 60 seconds(s)
    13:37:52.9143 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:37:52.9145 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 0 seconds(s)
    13:37:53.6528 void ESDCustomPlugin::onNativeProcessFinished(): The plugin 'Unity Integration' exited normally with code 1
    13:37:53.6529 void ESDCustomPlugin::restartNativeProcess(): Restarting plugin 'Unity Integration' in 60 seconds(s)
    13:38:53.2879 virtual bool MainWindow::event(): Wake up keypad(s).
    13:38:54.1487 void ESDCustomPlugin::StartPlugin(): The plugin 'Unity Integration' is unstable and was disabled (crash counter exceeded)


    I've downgraded back to 1.1.0 (at least for as long as the Stream Deck app doesn't force an update) but I'd like to find a fix if possible. I'm running on macOS 13 with Unity 2022.3 and the latest StreamDeck software. If you need any more info please let me know. I do have experience with building StreamDeck plugins (albeit not in Python) so feel free to throw any technical questions at me. Thanks!
     
  11. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    Hey, I'm sorry you are having issues with the new version. Just to clarify, the Asset Store package includes a ".streamDeckPlugin" file with each version, which is the SDK side of the plugin, which should always allow you to downgrade in case something breaks, so that you never get any downtime.

    Regarding your issue, sadly the output you shared doesn't say much. Can you confirm you have a matching version between Unity and Dtream Deck? You can install the given ".streamDeckPlugin" file included in the asset store package instead of going through the Stream Deck store to be completely sure. I develop mainly on MacOS, so I have the exact same env as you seem to have.

    If you confirmed you are matching all versions and it still does not work, you will have to replace the contents of the plugin with the decompiled version of the plugin, found here: https://github.com/AdamCarballo/streamdeck-unity-plugin to get all the debug logs, so that we can get a specific error outputted.

    The SDK contents for MacOS (that should be replaced) are in
    ~/Library/Application\ Support/com.elgato.StreamDeck/Plugins/com.adamcarballo.unity-integration.sdPlugin/
    - Make sure the Stream Deck app is closed during this whole process.

    After you pull the decompiled SDK plugin, open the
    manifest.json
    and replace the
    "CodePathMac": "plugin/dist/StreamDeckUnity"
    , line towards the end, with
    "CodePathMac": "test.command"
    . This should create an
    sdi_debug.log
    file in the same directory upon opening the Stream Deck application, and should contain many more logs.

    Let me know if you have any more questions or if you need any help with any of the steps. Hoepfully we get more specific reporting
     
  12. pilkycrc

    pilkycrc

    Joined:
    Mar 28, 2014
    Posts:
    3
    Ok, so I think I've figured it out. I'm having to run the
    test.command
    script through Terminal but it gives back


    Traceback (most recent call last):
    File "/Users/martinpilkington/Library/Application Support/com.elgato.StreamDeck/Plugins/com.adamcarballo.unity-integration.sdPlugin/plugin/main.py", line 14, in <module>
    from actions import InvokeMethodAction, SetFieldPropertyAction, \
    File "/Users/martinpilkington/Library/Application Support/com.elgato.StreamDeck/Plugins/com.adamcarballo.unity-integration.sdPlugin/plugin/actions.py", line 38
    match self.settings["type"]:
    ^
    SyntaxError: invalid syntax


    A quick bit of googling and it seems match might be a Python 3.10 feature. However, Apple being Apple, macOS seems to only ship with Python 3.9.6. I installed Python 3.11 via Homebrew and after some tweaking I managed to get the decompiled version working (for some reason the StreamDeck didn't like using "CodePathMac/Win" so had to remove those in favour of a plain "CodePath"). It also seems to get the pre-built plugin working after restarting a few things.

    I should be good for now, but may be a case of either needing to drop down to only using 3.9.6 features or letting people know they need to install python 3.10+ on macOS.

    Thanks for the help!
     
  13. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    Ah dammit :(

    Thank you for all the testing. I'll have to investigate a bit more, as the compiled python that comes from the Stream Deck store actually uses PyInstaller, which should bundle the actual python interpreter with the scripts, and checking the last build it used 3.11, so either PyInstaller is not doing it correctly, or based on your observations it seems the installed interpreter is still being used instead of whatever is bundled...

    Anyways, I'm glad is working for you now, and thanks again for all the troubleshooting :)
     
  14. JuniorLongfellow

    JuniorLongfellow

    Joined:
    Feb 27, 2013
    Posts:
    19
    I think I'm having the same issue as above. Can you help me fix it?

    Moreover, Streamdeck recently stopped working. When the project loads the plugin says its unable to connect. On the latest version of the plugin, unity 2022.3.5 on mac.
     
  15. JuniorLongfellow

    JuniorLongfellow

    Joined:
    Feb 27, 2013
    Posts:
    19
    Got it working, I can confirm the fix is upgrading your macs python install (I used Brew) then installing the plugin included in the asset, not the Elgato plugin store.
     
  16. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    So sorry for the issues, I need to check with Stream Deck people if the uploaded plugin is correct, until then use the one included in the asset. Regarding the python version, I'm also investigating why it's not using the internal bundled binaries
     
  17. lecramr

    lecramr

    Joined:
    Jun 22, 2023
    Posts:
    7
    Hey, I have multiple Pages in the StreamDeck of Custom Buttons. But with the Method: "StreamDeckSettings.SetButtonTitle(this.Title, this.Id);" I can only set the Buttons of the Page currently shown on the StreamDeck, not the next Page. Is this a known Issue? If so is there any workaround?

    Thanks in advance!
     
  18. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    Hey, sadly this is a limitation of the Stream Deck SDK, at least as far as I'm aware.

    When a page is switched on the Deck, the software will register all its actions into an active list, while removing whatever was there before (your previous page). This prevents anything and anyone from recognizing any other actions not present on the current page, as the SDK just replies with "This does not exist".

    I could maybe try to keep track of all open pages and active actions, or make some kind of queue for missing actions, but these are all workarounds, and sadly not so simple to implement without entering into a minefield of possible bugs.

    Is the fact that you can't modify non-loaded actions something that's currently majorly blocking you in some way?
     
  19. abhishek21296

    abhishek21296

    Joined:
    Jun 17, 2020
    Posts:
    4
    @Xelnath Did you get a solution, I am trying to do the same and getting the same error. I event tried a 32x32 random texture and it still disconnected.
    @Adam_Carballo any suggestions? I need to update the button textures from unity.
     
  20. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    Hey @abhishek21296, could you post the code where the image is being set, and the image itself (or the base64 version of it)?

    That way I can try to reproduce it on my end :)
     
    Last edited: Sep 15, 2023
  21. abhishek21296

    abhishek21296

    Joined:
    Jun 17, 2020
    Posts:
    4
    Code (CSharp):
    1. public void ToggleTexture() {
    2.  
    3.         var randomColors = new Color[texSize * texSize];
    4.         for (var i = 0; i < randomColors.Length; i++) {
    5.             randomColors[i] = Random.ColorHSV(0, 1);
    6.         }
    7.  
    8.         var randomImage = new Texture2D(texSize, texSize);
    9.         randomImage.SetPixels(randomColors);
    10.         StreamDeckSettings.SetButtonImage(randomImage, "ToggleTexture", "StreamDeckManager");
    11.     }
    I tried following image as 13x13 texture2d using the example funciton from the demo.
    The blank texture of the same size works even with 128x128. I think its the payload size which is causing the issue. Probably 1024 character is the payload limit.

    base 64: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAClklEQVQoFRXS/S/UARwH8Pf3jjw/dDl2445LLi5X1y4n/YCetXXYeYqttKsMFSs9XFvTUU2qVUvnl85MNTFPlUPWXNcDmxjy7Gqesti0cBSdy6f1+hte0E9XU0RTC+2RBtK5fA25cf3p9tty8lNE0zblRqL93uQVK6O6YgkJ/fxItMGH2N4MS+O9VoyGrUlQeomxaJ3HRPUQ6h+eRcG1MhT+2YV1E3No6HfFyaxMDMwZwDbPr9eMrGYjznECi19/wyNRAUy+RL+Bh8OPuhEzJsBrTg9UvAXUt3ciNfoMwDAsYucUUsjVQXr1+QrlxWeRja0zVabNkjObRQzfnULChCR2jyGOrYAGmtuINaNIRZfyL5YrkjHVw4cptg4CgSeyXiRAbteKkqJRZCSoILYakZaVBG6GEsyc7ASJaidhkZvgL+UjoEwMu8QdCP3yHTnmG+hVH4dunIcgC4MRyXZ0N78Bo4gKpAAHD6xb9oJ+2gHxcaGYMrfiyAegkeeJ8V9dKKgx4mZuBkwVzzBGTrDhJKph+dQGRXwyOjOzsVbliyWVCUcPBMBH9w7aFj2kwW5wNbtBKo+EdvM+sIfrjZoqQxNcyvOApR+Y8ZhFdG8gPvb1IZtxwppUiLnneug0x1BpHMXAt2Fgk2QLXdQaKF/0hA7ulVGQWETsUDbVNpSSnaMztXdN0+4APvG5HEqKUNCQUywhWJhKLq4gVog/hQtEVGMno8mOHtq5qqYZSzr5Su2JK/Kk3AuX6X1rG5Xee/B/hIPGEi6Bz2oywsIqAZkUVnt7aKOKMNjJRWl6I4of34VpZRwLvCGcL+kAK1IlgXxAjlunVuBgVeL6UyOsh4LA4f5Eyh0TxkdGwTotRIpOj/vKS1C7++EfCzkeusjRdMkAAAAASUVORK5CYII=
     
  22. Adam_Carballo

    Adam_Carballo

    Joined:
    Jun 1, 2014
    Posts:
    34
    I couldn't directly use the base64 you posted (I think some format on how I pasted was probably wrong, but the deck didn't actually disconnect - anyway). Still, converting it to an image and then using the normal API I was able to send it to the deck without issues.

    What Stream Deck unit do you have? Maybe some hardware units have some more specific limitations on the payload? Seems quite odd though, as 13x13 is quite small. I've pushed much higher resolution stuff in the past.