mbraceproject / FsPickler

A fast multi-format message serializer for .NET
http://mbraceproject.github.io/FsPickler/
MIT License
324 stars 52 forks source link

Added Unity3D build #58

Closed cloudRoutine closed 8 years ago

cloudRoutine commented 8 years ago

I noticed the discussion about Unity3d support so I tried using FsPickler inside the engine but it couldn't load properly due to incompatible dependencies and function/method calls.

The new project FsPickler.Unity3D is in the "platforms" folder using links to all the original files. The project is targeting the Unity 3.5 .net Base Class Libraries framework. You may need to have the Unity Engine installed on your machine in order to select it in the Target Framework dropdown in the project's properties view. If you can't build it on your machine that might be the issue.

There is a new compiler directive UNITY that was inserted wherever necessary to ensure compatibility with the framework.

System.Numerics is not available on this platform so I added the reference to System.Threading via the TaskParallelLibrary package off of Nuget.

The "build.fsx" was not modified to include this new project.

This modified version successfully loads in the Unity3D engine.

eiriktsarpalis commented 8 years ago

Hi,

Thanks for taking the time to write this. I have a few misgivings about this particular PR for the following reasons:

I guess the first two points stand out here, I could accept this once they are resolved. Another avenue is to maintain this as a fork, like the Tachyus guys have done with Xamarin support.

Thanks,

cloudRoutine commented 8 years ago

It seems like it'd be easier for me to maintain a fork since you don't have access to Unity and ideally a lot of the testing would need to happen inside a running instance of the engine. Plus it'd be easier to make tweaks specifically for easier usage in that context.

Thanks for the feedback

eiriktsarpalis commented 8 years ago

I'd still be happy to accept changes that make building for unity environments easier. For instance all the changes of type

#if UNITY
    propertyInfo.GetValue(o, [||])
#else
    propertyInfo.GetValue(o)
#endif

I would just like these to avoid F# 4.0 boolean expressions (for now).

cloudRoutine commented 8 years ago

Cool, I'll try to clean them up and submit a new PR soon.

varon commented 8 years ago

@cloudRoutine Did you have any success with this? It's something I'd be interested in as well.

cloudRoutine commented 8 years ago

I ran into some intractable issues in the project I wanted to use FsPickler for, so I put it aside and forgot I said I'd do this X_X