Search Unity

DLLs in Web Player deployment

Discussion in 'Scripting' started by zekizeki, Nov 10, 2007.

  1. zekizeki

    zekizeki

    Joined:
    Jul 22, 2007
    Posts:
    22
    Hi there :) my first question on these forums :D

    enjoying unity so far but i've hit an "is this possible" question.

    I have a c# network library that i've imported into Unity as a DLL. I've got it working when i deploy a standalone client but it doesnt work when i do a web player deployment.

    Is it possible to use additional DLLs for a web player deployment? I have the indie version trial at the moment so is there a chance this is a pro feature or is it just not possible?

    Any help much appreciated :)
    Rob
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Yes. This should just work.

    You might want to look at /Applications/Utilities/Console.app for output when loading the web player.
     
  3. zekizeki

    zekizeki

    Joined:
    Jul 22, 2007
    Posts:
    22
    Thanks for the speedy answer Joachim :)

    Looks like its a security exception caused by using the System.Threading classes.

    Code (csharp):
    1.  
    2. unity security internal call - throwing exception
    3.  
    4. DETAILED EXCEPTION
    5.  
    6. System.Security.SecurityException: This method is not supported in the unity web player for security reasons.
    7. in (unmanaged) 0x19467b79
    8. at (wrapper managed-to-native) System.Threading.NativeEventCalls.CreateEvent_internal (bool,bool,string,bool) <0x00004>
    9. at System.Threading.EventWaitHandle..ctor (bool,System.Threading.EventResetMode) <0x00035>
    10. at System.Threading.AutoResetEvent..ctor (bool) <0x00017>
    11. at (wrapper remoting-invoke-with-check) System.Threading.AutoResetEvent..ctor (bool) <0x0003c>
    12. at smartnetlib.NetworkManager..ctor (smartnetlib.Connection) <0x000a0>
    13. at smartnetlib.Connection..ctor () <0x00029>
    14. at LibRunner.Connect () <0x00022>
    15. at (wrapper dynamic-method) LibRunner.LibRunner$Connect$ (object,object[]) <0x0000a>
    16. at (wrapper delegate-invoke) System.MulticastDelegate.invoke_object_object_object[] (object,object[]) <0x00057>
    17. at Boo.Lang.Runtime.RuntimeServices.Dispatch (object,string,System.Type[],object[],Boo.Lang.Runtime.DispatcherCache/DispatcherFactory) <0x00089>
    18. at Boo.Lang.Runtime.RuntimeServices.Dispatch (object,string,object[],Boo.Lang.Runtime.DispatcherCache/DispatcherFactory) <0x0002d>
    19. at Boo.Lang.Runtime.RuntimeServices.Invoke (object,string,object[]) <0x00091>
    20. at UnityScript.Lang.UnityRuntimeServices.Invoke (object,string,object[],System.Type) <0x0001c>
    21. at connectButton.OnGUI () <0x000ec>
    22.  
    23.  
    24. DETAILED EXCEPTION END
    25.  
    26. SecurityException: This method is not supported in the unity web player for security reasons.
    27. System.Threading.AutoResetEvent..ctor (bool) <0x00017>
    28. (wrapper remoting-invoke-with-check) System.Threading.AutoResetEvent..ctor (bool) <0x0003c>
    29. smartnetlib.NetworkManager..ctor (smartnetlib.Connection) <0x000a0>
    30. smartnetlib.Connection..ctor () <0x00029>
    31. LibRunner.Connect () <0x00022>
    32. (wrapper dynamic-method) LibRunner.LibRunner$Connect$ (object,object[]) <0x0000a>
    33. UnityScript.Lang.UnityRuntimeServices.Invoke (object,string,object[],System.Type) <0x0001c>
    34. connectButton.OnGUI () <0x000ec>
    35.  
    36.  
    37.  
    it looks to be the AutoResetEvent that is making it break, i dont know an alternative unfortunately :(
     
  4. helmishariff

    helmishariff

    Joined:
    Nov 29, 2007
    Posts:
    107
    It is because security reason. Yes, u can deploy it but u need to register the dll manually or by installer on client pc. Just like unity web player. :)
     
  5. htwarrior

    htwarrior

    Joined:
    Feb 25, 2006
    Posts:
    40
    Maybe I didn´t undestand well but I get from this that if I have a project with javascript and c#, I wil have problems with the c# part of the code when using Unity Web Player. Is this correct?.

    HTWarrior
     
  6. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    Actually when you use a .NET assembly DLL like he is doing, the code is added to the assembly for the whole game, so no DLLs to register. That's why we can still use them with the webplayer and Unity Indie, where we cannot use standard DLLs. Unless I am mistaken. ;-)

    -Jeremy
     
  7. helmishariff

    helmishariff

    Joined:
    Nov 29, 2007
    Posts:
    107
    He could use some library which need proper authorization for example network library. I have developed a activeX like on c# .net, it run fine on browser but can't execute network library or read/write to disk. It's because security, client application can't simply access those features. But I'm not sure with dll which load with unity web player.