Vargol / PhotonPump

A .net port of Sunflow
GNU General Public License v2.0
3 stars 4 forks source link

Unity3D compatibility #3

Closed Rbn3D closed 8 years ago

Rbn3D commented 8 years ago

I'm trying to run SunflowSharp.dll inside Unity, I'm getting this error while using the api to describe the scene:

MissingMethodException: Method not found: 'System.Threading.Monitor.Enter'. SunflowSharp.RenderObjectMap.update (System.String name, SunflowSharp.Core.ParameterList pl, SunflowSharp.SunflowAPI api) (at SunflowSharp/PhotonPump/SunflowSharp/RenderObjectMap.cs:107) SunflowSharp.SunflowAPI.update (System.String name) (at SunflowSharp/PhotonPump/SunflowSharp/SunflowAPI.cs:313) SunflowSharp.SunflowAPI.options (System.String name) (at SunflowSharp/PhotonPump/SunflowSharp/SunflowAPI.cs:607)

Unity targets an special Mono version with .Net 2.0 feature set that supports most .Net features up to .Net 3.5. But it doesn't supports the "lock" keyword or other Net 4.0 features.

I know this is not really a SunflowSharp issue, but an unity's one. But I'm interested on make it work. If you can give me some advice it would be appreciated. I could eventually make my own fork and make this work if it's feasible.

Rbn3D commented 8 years ago

I finally managed to compile it:

Here is what I did:

  1. Set frameworrk version to 3.5 (Unity 3.5 full base libraries)
  2. Remove and add all references
  3. Add System.Threading reference (You can get this from rX) (reactive extensions)

Now it will compile and run inside Unity without problems.