Robmaister / SharpNav

Advanced Pathfinding for C#
sharpnav.com
Other
537 stars 129 forks source link

Security bug in unity webplayer #12

Closed sysujack closed 10 years ago

sysujack commented 10 years ago

I use sharpnav in pc standalone, it's works fine. But when i deploy the app in webplayer, Exception " System.MethodAccessException: Attempt to access a private/protected method failed " was throw.

Code “public static readonly int SizeInBytes = Marshal.SizeOf(new Vector3())” in Vector3.cs lead to this problem. it is unmanaged code. I comment the code line, it work fine.

Robmaister commented 10 years ago

So there are several compile configurations for various engines that use the engine's Vector3 implementation. I've been meaning to add one for Unity, I'll do that in a little while.

But since the standalone configuration should work in any trust level, including restricted ones like within browsers, I'll remove the offending code.

Robmaister commented 10 years ago

So I added a Unity3D target. It's horribly broken right now since Unity prefers camelCase over PascalCase, so just keep using the Standalone target. I'll mull over different ways of fixing it.

Robmaister commented 9 years ago

Update: removed the Unity3D target. There are already a lot of pathfinding libraries available (including the built-in one) and supporting the different casing of Unity3D's vectors will either be a pain in the ass or inefficient.

I may revisit this in the future if there's enough demand or a good reason why there should be another pathfinding solution for Unity.

SetoKaiba commented 7 years ago

There should be one because the built-in is without the support of runtime navmesh generation..

Robmaister commented 7 years ago

The Standalone version will work with Unity, you'll just have to convert SharpNav.Geometry.Vector3 into UnityEngine.Vector3.

cr4yz commented 7 years ago

Is it possible to build SharpNav targeting .NET 3.5 for use in Unity?

Robmaister commented 7 years ago

I don't thing there's anything in particular preventing that from working. If I'm using some newer API that prevents it from compiling against .NET 3.5, let me know (in a separate issue) and I'll make it work.