akakeiz / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

Unity3D Webplayer Support #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Unity3D web player support is broken even after commenting out the #defines 
mentioned in the wiki.

What steps will reproduce the problem?
1. Comment out the two #defines mentioned in the wiki. 
2. Compile lidgren and include the DLL in a Unity3D project set to the "Web 
Player" platform.
3. See internal compiler errors from missing System.Net references due to 
Unity3D's security stance in web player builds.

What is the expected output? What do you see instead?
Unity3D set to the web player platform should compile with Lidgren referenced. 
Unity3D instead encounters an internal compiler error.

What version of the product are you using? On what operating system?
Lidgren @ rev 254 with Unity3D 3.3.0f4

Please provide any additional information below.
The errors are caused by Unity3D's strict security policy when building using 
the web player platform. Lidgren is referencing functionality that is stripped 
out of the System.Net DLL provided for these builds. The offending types are 
PhysicalAddress and NetworkInterface. Adding a #define and #if/#endif guard 
around GetNetworkInterface(), GetMacAddress(), and GetMyAddress() in 
NetUtility.cs resolves the problem. However, the new UPnP port forwarding code 
adds a dependency on NetUtility.GetMyAddress(), so a stub function that returns 
a null IPAddress and mask is required to compile. Unfortunately this breaks the 
UPnP port forwarding feature, so solving this in a more robust way would be 
preferred.

Thanks!
-James

Original issue reported on code.google.com by jhill...@gmail.com on 21 Jun 2011 at 3:06

GoogleCodeExporter commented 9 years ago
Thanks!

I've checked in the relevant define in revision 246.

UPnP router modifications are very unlikely to work from a web browser ever 
(and rightly so!) so I don't think that's a big issue.

Original comment by lidg...@gmail.com on 21 Jun 2011 at 6:50

GoogleCodeExporter commented 9 years ago
Oh... and the wiki page was updated: 
http://code.google.com/p/lidgren-network-gen3/wiki/Unity3D

Original comment by lidg...@gmail.com on 21 Jun 2011 at 6:51

GoogleCodeExporter commented 9 years ago
Just re-opening this since it looks like you accidentally missed the #if/#endif 
guard around GetNetworkInterface(). All the other changes should work 
perfectly, I'll test it out tomorrow.

Amazing response time, thanks!

Original comment by jhill...@gmail.com on 21 Jun 2011 at 9:05

GoogleCodeExporter commented 9 years ago
Indeed I did, fixed in 248; thanks again!

Original comment by lidg...@gmail.com on 21 Jun 2011 at 9:12