Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Using Accord.net with Unity3d(windows) error #874

Open
AbhimanyuAryan opened this issue Sep 16, 2017 · 14 comments
Open

Using Accord.net with Unity3d(windows) error #874

AbhimanyuAryan opened this issue Sep 16, 2017 · 14 comments
Assignees

Comments

@AbhimanyuAryan
Copy link

AbhimanyuAryan commented Sep 16, 2017

Hi, I'm following this blog post.

But when I play my scene in Unity. Unity throws an error

TypeLoadException: Could not load type ‘Accord.DirectSound.AudioDeviceInfo’ from assembly ‘Accord.Audio.DirectSound, Version=3.3.0.0, Culture=neutral.

I'm using Unity2017.1 @unitycoder have you found a solution?

@unitycoder
Copy link

for temporary fix can delete the Accord.Audio.DirectSound.dll..

in 2017 with 4.6 enabled is says, this so not sure if some problem with that file?
"Unloading broken assembly Assets/Plugins/Accord.Audio.DirectSound.dll, this assembly can cause crashes in the runtime"

@cesarsouza
Copy link
Member

Hi everyone,

@AbhimanyuAryan, many thanks for opening the issue! Please, may I ask which Accord.NET assemblies do you need to load in Unity? If your application does not need audio support, you can safely remove the references to any of the Accord.Audio assemblies from your project.

Regards,
Cesar

@AbhimanyuAryan
Copy link
Author

AbhimanyuAryan commented Sep 17, 2017

net35. So, if I'm not using Audio Support then let them be there? @cesarsouza

@cesarsouza
Copy link
Member

You can remove them if you want. If you are not using audio, you can remove all the .Audio assemblies, such as Accord.Audio, Accord.Audio.DirectSound, Accord.Audition, etc. In the same way, if you are not using video, you can also remove all the Accord.Video assemblies such as Accord.Video, Accord.Video.FFMPEG, Accord.Video.DirectShow, etc.

@cesarsouza cesarsouza self-assigned this Sep 20, 2017
cesarsouza added a commit that referenced this issue Sep 20, 2017
 - Updates GH-874: Using Accord.net with Unity3d(windows) error
@cesarsouza
Copy link
Member

cesarsouza commented Sep 22, 2017

The latest pre-release version of the framework can now be installed in Unity projects through NuGet. A preliminary guide on how to install the Accord.NET Framework on Unity through NuGet is now available here.

It is not perfect, though. There are a few steps which might have to be documented better. If anyone finds a problem while following them, please feel free to update this issue or open a new one here in the issue tracker!

@cesarsouza
Copy link
Member

I've just updated the tutorial with a series with a series of screenshots. Hope it will be easier to follow now!

@AbhimanyuAryan
Copy link
Author

@cesarsouza can you include instructions on Visual Studio Code instead of Visual Studio? Also, use Nuget CLI commands. With that, you can actually help MacOS users as well 💯

Plz, use the command line. Say restore packages with dotnet restore & stuff like that

Here are some links:
https://docs.microsoft.com/en-us/dotnet/core/tools/project-json-to-csproj

I know how to deal with packages in project.json based project but no idea with .csproj based projects. Can you help out here a bit?

@cesarsouza
Copy link
Member

Hi @AbhimanyuAryan,

Thanks for the suggestion. To tell the truth, I do not know much about VS code or the project.json project format (wasn't it deprecated in favor of .csproj?).

Another complicating factor is that the Unity editor actually performs a bunch of magic when interacting with VS. Since I do not own a Mac, I do not know how it interacts with VS code under OS X. So if you do not mind, I might need a bit of help from you as well to write a tutorial for Mac OS X users 😄

Have you been able to follow the tutorial up to a certain point? If you are stuck the part where I had switched to VS to download and install the framework's NuGet packages, I guess you can achieve the same using

dotnet add package Accord.MachineLearning --version 3.7.2-alpha

Please let me know if it works for you!

Regards,
Cesar

@AbhimanyuAryan
Copy link
Author

I had already tried that

screen shot 2017-09-24 at 5 19 21 am

@cesarsouza
Copy link
Member

cesarsouza commented Sep 24, 2017

Hi @AbhimanyuAryan,

From your screenshot I can see there are indeed two .csproj files in your solution folder. Have you tried to do as the error message says and specify which one should be used? I guess this should be done using

dotnet add Snapchat.csproj Accord.MachineLearning --version 3.7.2-alpha

or

dotnet add Assembly-CSharp-(rest of the proj filename that is not completely visible in the screenshot).csproj Accord.MachineLearning --version 3.7.2-alpha

Hopefully one of those should work!

Regards,
Cesar

@AbhimanyuAryan
Copy link
Author

❯ dotnet add Snapchat.csproj Accord.MachineLearning --version 3.7.2-alpha
Specify --help for a list of available options and commands.
Unrecognized command or argument 'Accord.MachineLearning'

@cesarsouza
Copy link
Member

I think it's

dotnet add Snapchat.csproj package Accord.MachineLearning --version 3.7.2-alpha

or

dotnet add package Accord.MachineLearning Snapchat.csproj --version 3.7.2-alpha

@AbhimanyuAryan
Copy link
Author

❯ dotnet add Snapchat.csproj package Accord.MachineLearning --version 3.7.2-alpha

Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.

  Writing /var/folders/5n/ghyfb6n9387_h2w5ycg9pd980000gn/T/tmp6NzYmT.tmp
info : Adding PackageReference for package 'Accord.MachineLearning' into project 'Snapchat.csproj'.
error: Value cannot be null.
error: Parameter name: projectUniqueName

@cesarsouza
Copy link
Member

I've also tried installing them through VS developer command prompt, but nothing works. I do not get the same error as you though, I get something similar to NuGet/Home#5454.

Have you tried installing the packages manually (as shown in the first part of the guide)?

Regards,
Cesar

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants