speps / XInputDotNet

C# wrapper around XInput, works with any Mono or .NET application (eg. Unity3D)
466 stars 96 forks source link

Release XInput.NET v2017.04-1 is broken for Unity5.5.0f3 Personal edition #24

Closed maakep closed 7 years ago

maakep commented 7 years ago

I've been using the previous release until I had some issues with build, which you took care of and created a new release. I removed the previous release Plugin and imported the new release as I did before which gave me broken references which I couldn't seem to fix.

The latests release has a different folder structure and different filenames on the dlls. The instructions saying

Special instructions for Free version of Unity

Import the .unityPackage as described above
Copy [Project Folder]\Assets\Plugins\x86\XInputInterface.dll to [Project Folder]\XInputInterface.dll
Making a Build does NOT require to copy XInputInterface.dll in the same folder the your game .exe file

cannot be applied to latest release since 1) The folder structure is now Assets\XInputDotNet\Plugins\etc... 2) The filenames are XInputInterfaceX86.dll and X64 for 64.

I tried many things, such as resetting the structure to previous, but couldn't get the references to work. I downloaded the previous release and imported it, which is working like before. (I've never done the Special instructions for Free version of Unity though)

speps commented 7 years ago

You do not need to do those instructions anymore with Unity 5. Just delete everything you had that is related XInput.NET in your project (delete outside of Unity), then import the package again.

I updated README.md and the instructions on the release page.

speps commented 7 years ago

Also note that because you're using an earlier version of Unity than 5.6.0f3, you might need to update the plugin settings to the ones described on the README page.

maakep commented 7 years ago

I see. Well I did those things, and it seemingly didn't work. I can try to upgrade Unity to your version and try again.

These are the steps I followed:

  1. Download the .unitypackage
  2. Delete every previous trace of the XInputDotNet plugin
  3. Assets -> Import package -> Custom package -> Select newly downloaded .unitypackage (These files are now under path Assets/XInputDotNet/Plugins/...)
  4. Make sure every dll has correct Platform settings

Result: Could not resolve this reference. Could not locate the assembly.

This is solved in the 3rd step when importing the old release, even if you can't build because the Platform settings are wrong you can still use the assembly, which I cannot with the new release. It seems to not be registered as an assembly for some reason.

speps commented 7 years ago

There's definitely something strange going on. I'm investigating.

speps commented 7 years ago

Could you try this please? https://github.com/speps/XInputDotNet/releases/tag/v2017.04-2

That shouldn't error, I did create a new project and imported the package and could build both x86 and x86_64.

maakep commented 7 years ago

Like before; Assets/scripts/ControllerHelper.cs(7,7): error CS0246: The type or namespace name `XInputDotNetPure' could not be found. Are you missing an assembly reference?

line 7 is using XInputDotNetPure;

Manually adding XInputDotNetPure.dll in Visual studio removed the build errors from Visual Studio but Unity doesn't allow me to start. After restarting Unity the manually added assembly is removed in the visual studio build.

Perhaps noteworthy is that I'm running Visual Studio Professional 2013, which seems to have some issues with Unity. Could it be that Visual studio is not fully integrated with Unity (I am, for instance, not automatically gettign the "Attach to Unity" debugger functionality, and when I add a script I need to restart visual studio) and therefore is having issues with building it?

speps commented 7 years ago

Wait, where are you getting this error? If it's in VS, it should add the DLL correctly to the references of the created project. Unity has done that correctly for years, it worked on VS2010...

Make sure the structure like so :

That's the bare minimum required to run.

speps commented 7 years ago

By the way, Visual Studio 2015 is free so you might as well you use that. The Visual Studio Tools for Unity are free too since last year.

speps commented 7 years ago

Also, I reorganised the files again so make sure to delete the old ones again.

maakep commented 7 years ago

That is the structure, I'm getting the errors in both Unity and VS. Keep in mind, it works flawlessly with the release 2 releases ago.

Yeah, I'm upgrading to Unity 5.6 now and adding the community 2017 VS from the install wizard.

maakep commented 7 years ago

Yeah, I clean the old files before every import.

maakep commented 7 years ago

Give me a few minutes, I'm going to try to uninstall vs2013 and install the newer.

speps commented 7 years ago

You don't need to uninstall any old version of VS, it's not like Unity. 2 releases ago didn't work either, it was giving a different error.

maakep commented 7 years ago

Huh? I'm uninstalling to keep my PC somewhat clean, or are you telling me if I run the Visual Studio 2017 Community wizard it will actually upgrade my previous installation? Because that'd be magical.

speps commented 7 years ago

No I mean, uninstalling VS can take some time, and it doesn't hurt to keep old versions around. I've had all versions since 2010 once, it all worked fine. It doesn't upgrade it, it just installs the new version.

maakep commented 7 years ago

Haha, the uninstall failed anyway - didn't expect any less. :heart: Guess I'm keeping it.

speps commented 7 years ago

Also, are you using the 32 bits or 64 bits version of the Unity editor?

maakep commented 7 years ago

64

speps commented 7 years ago

Okay, I just tried again with the same package and I see no issues with a new project. Can you try that? Create a new project, import the package, open the XInputTest.unity scene and run it.

maakep commented 7 years ago

Seems to have been an issue with the unity version. After upgrading it works nicely.

speps commented 7 years ago

Ha nice! They did fix a bug related to this recently.

maakep commented 7 years ago

Thanks for your patience :blush:, now to fix all the .5 -> .6 project upgrade errors :weary:

EDIT: There were no errors! Only my missclicks, wohoo!

Thanks for all the help!

speps commented 7 years ago

Good luck ;)