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

Thinkgear DLLs

Discussion in 'Editor & General Support' started by sidestepper, May 30, 2010.

  1. sidestepper

    sidestepper

    Joined:
    Oct 2, 2008
    Posts:
    96
    Hello,

    I've been working with Unity for some time now, and I did some work with ExitGames Neutron/Photon tech and if I recall they used a DLL plugin to the Unity app, and it did work in webplayer builds, but they were only using sockets so I guess it was okay(Since I've used sockets myself in Unity with success). I mention this because: I have been working with the Neurosky Mindset technology lately(http://www.neurosky.com/) to work with their bluetooth headset and I've gotten it to work with great success in Unity for local builds, however webplayer builds come back with the following:

    DllNotFoundException: P-Invoke is not supported in the web player for security reasons.
    ThinkGearController+<>c__CompilerGenerated0.MoveNext ()
    UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
    UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
    UnityEngine.Component:SendMessage(String, Object)
    ThinkGearGUI:OnGUI()


    Is this because rather than using Sockets they are accessing COM ports? I have gone so far as to write my own COM port communication wrapper in an effort to not require the thinkgear dll, which again, I got it working locally, but not in a webplayer build with the same error as above. Neurosky is still very new, but I am hopeful some connections could be made here between Unity and Neurosky ;)

    If anyone has some info on this already, please let me know. As far as I can tell it is impossible at this time for the headset to work in a unity webplayer build :(
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    No this is because you have an assembly that uses unmanaged code (shown by the P-Invoke part of the error)
    Unmanaged code (i.e. c / C++ dlls) can not be used on the webplayer at all.

    Photon / Neutron and many others don't use unmanaged code. They use .NET assemblies which also have the DLL file extensions. These, as long as they only use the webplayer available frameworks (not all from standalone distribution / editor) are fine to go.
     
  3. Quietus2

    Quietus2

    Joined:
    Mar 28, 2008
    Posts:
    2,058
    Iirc System.IO.Ports is removed from webplayers builds.
     
  4. sidestepper

    sidestepper

    Joined:
    Oct 2, 2008
    Posts:
    96
    Ok, thanks for the confirmation. I didn't think it would be possible, but wasn't sure exactly why. If the System.IO.Ports is removed from webplayer then it will be impossible because in order to access the COM port I need to use to use the SerialPort class inside of that namespace.

    Does Unity have any control over this or is it a limitation in the browser which forced Unity devs to exclude that namespace from the webplayer builds?

    If the devs for unity have any control over it, I would love to ask(as nicely as possible) for a workaround or exception to this in certain cases somehow.

    Is there a difference between handling input from COM Port USB Bluetooth(Which is what I have) versus machines that have it already built in, ie many(If not all) Mac computers? I would assume it still amounts to some kind of com port communication though.

    The use of a USB controller is technically a COM port thing right? How does Unity interface with those? Or do those also not work in web player builds?

    Sorry for all the annoying questions, just trying to make sure I've evaluated all options before I throw it out the window, I'd love to be able to get the headset input inside a web app.
     
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    This is a unity webplayer security part.
    You can not access any system device or anything related to the system at all.
    Independent on if it is COM, USB, Harddisk, File, processes nor System.Diagnostics / System.Environment

    You can communicate to the web but the web only (not even file:// protocol is available for example)

    There is no way to overcome that or break the security.
    If you require system hardware access, you must do standalone builds.
     
  6. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,341
    Just talking... is it possible to launch an external app from Unity? I could write a "format c:/" let's say in Visual Basic, make a zip file and then unzip it on the hd of the victim like any asset and then call it from Unity :twisted: :twisted: :twisted:
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    It is possible but not in the webplayer. The webplayer can not talk to the system at all
     
  8. sidestepper

    sidestepper

    Joined:
    Oct 2, 2008
    Posts:
    96