Quantcast
Channel: Questions in topic: "external-libraries"
Viewing all 86 articles
Browse latest View live

Use SSH.NET in Unity

$
0
0
Im trying to import that library: https://github.com/sshnet/SSH.NET but I can't make it run on Unity. I'm using Unity 5.5.0b7 (64-bit).

DLL in plugin folder not loaded?

$
0
0
Hallo I have a running project under .NET3.5 and VisualStudio 2015. It uses an external dll "OSIsoft.AFSDK". Everting is fine, no issues. THEN I moved all dll's (I copied the files one by one from references) to the plugin folder of the Unity project and got the error below. WHAT I tried 1. Changing plattform setting in Unity of all dll's set to x86_64 and back to "Any CPU"/"Windows" 2. Inspected the dll's with ildasm for the right version and existence of the methods. Result -> All Methods/Functions are existing. 3. Several restarts of Unity and Windows 4. Checked all solution found with google 5. Removed the System.*.dll's (The error is the same in this case!) WHAT I don't understand 1. What is the difference between VisualStudio and Unity? Why do they handle the dll's different? 2. When I change the System.Core.dll setting to x86 / Windows it should not be loaded. When I revert the setting it should load it. Whats wrong here? 3. Where can I reliable see what dll's are loaded and where from? 4. Why is the System.Core.dll not loaded when I put it into the Plugin folder? Target is just Windows / x86_64 Unity 5.4.2f2 Personal Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool) at System.Reflection.Assembly.GetTypes () [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0 at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0 at Mono.CSharp.Driver.Compile () [0x00000] in :0 at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0 The class System.Diagnostics.Eventing.EventProvider could not be loaded, used in System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 The class OSIsoft.AF.Diagnostics.EventProviderVersionTwo could not be loaded, used in OSIsoft.AFSDK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6238be57836698e6 The class EventData could not be loaded, used in OSIsoft.AFSDK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6238be57836698e6

how to create a wrapper for C++ class libraries

$
0
0

i want to use some C++ libraries in unity. unity just can use C style function libraries. how should i wrap the classes? think i want to use physx cloth or any other library. unity already do that with physx and some other libraries so it's possible. i know that C++/CLI is not an option here because they are mixed assemblies and mono doesn't support them. my target is windows. some of game libraries are static .lib files and some of them are DLLs. most of the third party game related libraries are C++ class libraries so we all need this. i know about some tools to create wrappers but i want to do that myself programmaticly because tools don't work well always.

How should I add references to additional Mono assemblies?

$
0
0

Unity is built on Mono. Mono includes a large and growing subset of .NET. Much of this subset is available out of the box with Unity, so I can do things like add "using System.Collections.Generic;" to my C# script and start using dictionaries and such.

However, if I add "using System.Data;" (for example) to my script, I get ...

error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System'. Are you missing an assembly reference?

The same thing happens with many other common assemblies. Obviously Unity is giving me a useful set of assemblies, but not everything.

Looking in my Unity 3.1 installation folder, I can see all these DLL's sitting in Data\Mono\lib\mono\2.0, including System.Data.Dll.

I can get my compile error to go away by copying the DLL I want into my Assets\Plugins folder. Is this the correct and best way to add an additional reference? I would prefer something like Visual Studio's reference management -- does this exist with Unity? What if I'm going to build for different platforms, do I need different versions of the DLL's?

This seems like it would be a common question, but searching the docs, answers and forums hasn't turned up a definitive answer. Links appreciated if I overlooked something.

How do I call an Office function from a C# script?

$
0
0
I'm working on a game that needs to use some Excel functions. I tried to import those dll's into the asset folder: Microsoft.Office.Interop.Excel.dll Microsoft.Vbe.Interop.dll Microsoft.Vbe.Interop.Formsl.dll Office.dll I'm using code like this: double[] num; Microsoft.Office.Interop.Excel.Application oXL = new Microsoft.Office.Interop.Excel.Application(); double resultNum = oXL.WorksheetFunction.Average(num); It works when I put it into a Windows console application. I have no errors or warnings while compiling. However, the Unity crashes while it reaches this line of code: double resultNum = oXL.WorksheetFunction.Average(num); The error reports "Read from location 00000000 caused an access violation." It seems that Unity couldn't find the WorksheetFunction class... Does anybody know how to call external functions from unity? Thanks! Momo

Performance penalties

$
0
0
Are there any performance penalties in putting classes in an external dll rather than defining them directly in Unity and letting them inherit from MonoBeaviour? Another way to put it - do I gain any performance by defining a class directly in a Unity script, letting it inherit from MonoBehaviour and make it a component of a GameObject, rather than having that class in an external dll and letting the calling script update the external class? This is mainly concerning physics functions in the FixedUpdate(). ///JmD

Build argument -reference:ALIAS=DLL

$
0
0
My problem is the following. As I need to use **System.Windows.Form** namespace for Windows dialogs I first tried to use normal "Edit Reference" in MonoDevelop, search for the .dll in ...\Unity\Editor\Data\Mono\lib\2.0 and just adding it. This caused a problem because as I had algo as reference System, when I write using **System.Windows.Form** and then build the solution, it tells me that it didn't found 'Windows' in 'System' namespace. This is obvious because it didn't had to lookup there. So I solved it in mono by adding "/reference:WinForm=" in compiler additional arguments and in my class heading: extern alias WinForm. When I needed to use a namespace from that import I write for example: WinForm::System.Windows.Forms.SaveFileDialog saveDialog = new WinForm::System.Windows.Forms.SaveFileDialog(); saveDialog.FileName = Path.GetFileName(myPathVar); My problem now is that I can't access the compiler arguments in Unity. Error: *Assets/scripts/GenerateFiles.cs(1,14): error CS0430: The extern alias `WinForm' was not specified in -reference option*, where do I put -reference?? I have tried: Unity.exe -batchmode -buildWindowsPlayer "PATH.TO.EXE.exe" -reference:WinForm="C:\Program Files (x86)\Unity\Editor\Data\Mono\lib \mono\2.0\System.Windows.Forms.dll" but it ain't working =S. Thanks in advance.

Editor scripts into external assemblies? how?

$
0
0
I have a class that I'd like to have a custom editor for. I have the class working in an assembly DLL ok. Now, how would I go about doing the custom editor? Can I put it into the same assembly? As I get it, it needs to go into (an) Editor folder, so do I have to have two assemblies, one for the main class, one for the editor? Or maybe there's some structure to the assembly itself? So confused!

Check external application preferences error

$
0
0
Hi ! After I open Unity and try to open any script I have this error : Unable to open Assets/xxx/xxx.cs: Check external application preferences

External DLL requiring Image

$
0
0
I have an external DLL that requires an Image from the System.Drawing namespace of C#. This, however, does not seem to be part of what Unity offers. Is there any way to get an Image, or something similar, into Unity?

Can I use .NET 4.5 assembly as external library?

$
0
0
I want to use set of features, implemented in .NET Framework v4.5. Cause Unity3D works on Mono runtime(equivalent to .NET 3.5), i think to use .NET4.5 assemblies as external plugin. Is it possible? If it possible, which runtime will be used for this libraries - Mono or assembly's target runtime (.NET 4.5 in my case)?

Question about external DLL

$
0
0
Hi Everyone! I Have a problem with an external DLL. I have to use a C++ dll that i've made to send commands to an eyetracker. The problem is that in the Unity Editor works, but compilled not. My C code goes like these: extern "C" { ... __declspec(dllexport) int close_connection() {...} } and in the C# scritpt i use [DllImport("EyelinkConnector")]. I've to put the dll in the "Editor" folder, because if not, it not work. From the unity editor works like a charm but when i compile the program ti can't load the dll, i got an exception that it could not be found. I've tried putting it in the same folder than the .exe, in "system", "system32" and so on, but nothing. Anyone can help me?

Control output of visual studio 2013 output

$
0
0
I have created an external library with some classes, basically my own game framework for use across many Unity projects. I have the build output going to a Libs folder inside the Assets folder in a Unity project. I went into the advanced build settings and turned the debug output off so it wouldn't output the debug database into the Libs folder. But it puts copies of the dependency .dlls. In this case its the UnityEditor and UnityEngine .dlls. Unity then throws an error, so I have to manually delete those two dlls from the Libs folder. I cannot find a way inside visual studio to stop it from writing those two dlls to the Libs folder. Does anyone know how to do this? Thanks in advance!

Unity TestTools and External DLL conflict?

$
0
0
Greetings everyone. I have a problem that I find weird. I have created some dll files that I want to use in my Unity project. I have compiled them with VS2012 and tested them outside of Unity and everything seems good. I have also Imported them successfully in Unity projects for test and again everything worked fine...until.. I tried to import Unity Test Tools in that project. Now I have tried this and it seems that, when the projects has Unity Test Tools loaded, my external Dll cannot be loaded and this error message comes up: > *Internal compiler error. See the console log for more information. output was: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.* *at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)* *at System.Reflection.Assembly.GetTypes () [0x00000] in :0* If I remove the dll, the error stops. If I remove Unity Test Tools the error also stops. Unity version is 4.3.3f1 Any Ideas? Thank you very much in advance for any help.

How Is 'fileID' Generated For Classes Inside an External DLL?

$
0
0
When you link to a MonoBehaviour that is inside of an external DLL, the resulting asset file refers to that particular class by a 'fileID' and the 'guid' of the external DLL. For example, a MonoBehaviour named 'a' inside of an external DLL would be show up in an asset's YAML file as:> m_Script: {fileID: -1880535464, guid:> 50df42a15edf64f1caa6bfd8fd2576ef,> type: 3} Where the guid (50df42a15edf64f1caa6bfd8fd2576ef) is the GUID assigned by Unity to the external DLL file. The 'fileID', however, is constant and is based on both the class's namespace and name. However, I cannot figure out how Unity takes the namespace and class name and generates the 'fileID' field. In our project, we have moved several classes into external DLLs, which unfortunately breaks the links in all of our asset files. If we could generate that 'fileID' field, we could easily repair those broken links inside of our asset files. Could you please tell us how to generate the 'fileID' for a particular class? Thanks.

Reference external project

$
0
0
I'm trying to to include an external library that I want to use between multiple projects. Monodevelop is fine with everything: ![alt text][1] Unity however, is not. Should I somehow inform unity about this reference? ![alt text][2] [1]: http://i.imgur.com/nWiKggs.png [2]: http://i.imgur.com/zLZM6QK.png

External library error without external libraries?

$
0
0
I get these three errors every time I attempt to build my project: NullReferenceException: Object reference not set to an instance of an object UnityEditor.Modules.DefaultPluginImporterExtension+c__AnonStorey63.<>m__E3 (UnityEditor.PluginImporter imp) (at C:/buildslave/unity/build/Editor/Mono/Modules/DefaultPluginImporterExtension.cs:133) System.Linq.Enumerable+c__Iterator1D`1[UnityEditor.PluginImporter].MoveNext () System.Collections.Generic.List`1[UnityEditor.PluginImporter].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128) System.Collections.Generic.List`1[UnityEditor.PluginImporter]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65) System.Linq.Enumerable.ToArray[PluginImporter] (IEnumerable`1 source) UnityEditor.Modules.DefaultPluginImporterExtension.GetCompatiblePlugins (System.String buildTargetName) (at C:/buildslave/unity/build/Editor/Mono/Modules/DefaultPluginImporterExtension.cs:133) UnityEditor.Modules.DefaultPluginImporterExtension.CheckFileCollisions (System.String buildTargetName) (at C:/buildslave/unity/build/Editor/Mono/Modules/DefaultPluginImporterExtension.cs:157) UnityEditorInternal.PluginsHelper.CheckFileCollisions (BuildTarget buildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25) UnityEditor.HostView:OnGUI() NullReferenceException: Object reference not set to an instance of an object UnityEditor.PluginImporter+c__AnonStoreyC.<>m__E (UnityEditor.PluginImporter imp) (at C:/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:104) System.Linq.Enumerable+c__Iterator1D`1[UnityEditor.PluginImporter].MoveNext () System.Collections.Generic.List`1[UnityEditor.PluginImporter].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128) System.Collections.Generic.List`1[UnityEditor.PluginImporter]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65) System.Linq.Enumerable.ToArray[PluginImporter] (IEnumerable`1 source) UnityEditor.PluginImporter.GetImporters (System.String platformName) (at C:/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:103) UnityEditor.PluginImporter.GetImporters (BuildTarget platform) (at C:/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:111) UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:129) UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:198) UnityEditor.HostView:OnGUI() Error building Player: Extracting referenced dlls failed. The most exotic thing I'm doing is using UnityEngine.Audio, so I've no idea how or why this is happening. I can build other projects without issue.

Using GDAL from Unity

$
0
0
Hello, I want to read a raster map from my Unity application. I planned to use Geospatial Data Abstraction Library(GDAL) for this task. This is a C++ library but it has a C# wrapper which handles C++ calls. I tried to use its C# wrapper from the unity. However, I could not achieve. Finally, I got the error below: **Failed to load 'Assets/GDAL/gdal_wrap.dll' with error '%1 is not a valid Win32 application. ', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly. GameController:Start() (at Assets/Scripts/GameController.cs:58) GameController:Start() (at Assets/Scripts/GameController.cs:15)** Is there anyone who achieved to use GDAL from Unity? Or, is there anyone who read raster map from Unity application? If yes, how? I am waiting for help. Thanks...

Audioclip error using NAudio to open MP3 file on Windows

$
0
0
I'm using the [NAudio libraries][1] to open an MP3 file from the HardDrive, convert the byte array returned to a float array and then create an audioclip to set it to an AudioSource because i created a visualizer and i need the audio coming from inside Unity not from the SoundCard, well the problem is that i only hear strange sounds maybe because of the structure of the final audioclip but i doesn't find where the problem is or even how to identify it because i don't know too much how the sound files work, so please someone help me to fix this issue. Also, sorry if i comitted too much language errors but my mother language is spanish using UnityEngine; using System.Collections; using NAudio; using NAudio.Wave; using System.IO; using NAudio.MediaFoundation; public class AbrirMP3 : MonoBehaviour { private IWavePlayer mWaveOutDevice; private WaveStream mMainOutputStream; private WaveChannel32 mVolumeStream; public GameObject Spectrum; public int position = 0; public int samplerate = 44100; public float frequency = 440; public AudioSource source1; public int SamplesArrayFloat; // Use this for initialization void Start () { } private bool LoadAudioFromData(byte[] data) { try { MemoryStream tmpStr = new MemoryStream(data); mMainOutputStream = new Mp3FileReader(tmpStr); mVolumeStream = new WaveChannel32(mMainOutputStream); mWaveOutDevice = new WaveOut(); mWaveOutDevice.Init(mVolumeStream); return true; } catch (System.Exception ex) { Debug.LogWarning("Error! " + ex.Message); } return false; } public static float[] ConvertByteToFloat(byte[] array) { float[] floatArr = new float[array.Length / 4]; for (int i = 0; i < floatArr.Length; i++) { if (System.BitConverter.IsLittleEndian) { System.Array.Reverse(array, i * 4, 4); } floatArr[i] = System.BitConverter.ToSingle(array, i * 4); } return floatArr; } private void LoadAudio() { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); ofd.Title = "Open audio file"; ofd.Filter = "MP3 audio (*.mp3) | *.mp3"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { WWW www = new WWW("file://" + ofd.FileName); Debug.Log("path = " + ofd.FileName); while (!www.isDone) { }; if (!string.IsNullOrEmpty(www.error)) { System.Windows.Forms.MessageBox.Show("Error! Cannot open file: " + ofd.FileName + "; " + www.error); return; } byte[] imageData = www.bytes; if (!LoadAudioFromData(imageData)) { System.Windows.Forms.MessageBox.Show("Cannot open mp3 file!"); return; } source1.Stop(); float[] f = ConvertByteToFloat(imageData); SamplesArrayFloat = f.Length; AudioClip audioClip = AudioClip.Create("testSound", f.Length, 1, 44100, false, OnAudioRead, OnAudioSetPosition); audioClip.SetData(f, 0); source1.clip = audioClip; source1.Play(); Resources.UnloadUnusedAssets(); } } void OnAudioRead(float[] data) { int count = 0; while (count < data.Length) { data[count] = Mathf.Sign(Mathf.Sin(2 * Mathf.PI * frequency * position / samplerate)); position++; count++; } } void OnAudioSetPosition(int newPosition) { position = newPosition; } private void UnloadAudio() { if (mWaveOutDevice != null) { mWaveOutDevice.Stop(); } if (mMainOutputStream != null) { // this one really closes the file and ACM conversion mVolumeStream.Close(); mVolumeStream = null; // this one does the metering stream mMainOutputStream.Close(); mMainOutputStream = null; } if (mWaveOutDevice != null) { mWaveOutDevice.Dispose(); mWaveOutDevice = null; } } // Update is called once per frame void Update () { } } [1]: https://naudio.codeplex.com/

Package manager for 3rd party libraries.

$
0
0
Hi. I'm using Unity 5.3.2f, MonoDevelop 5.9.6 and looking for package manager like Maven or Grandle in Java world. Is there any good solustions or manual capy/past is the best way to go? I would appreciate any help.
Viewing all 86 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>