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

How to connect to external server with DDE?

$
0
0
I am trying to make an online game that also uses realworld data from an external (not unity) source. The external data server is using DDE links to update data in real time. I can write a CSharp program in visual studio that connects to the data server correctly, however I am having trouble porting that CSharp code to work inside of unity as a script. The code requires an additional library NDde which can be found here https://ndde.codeplex.com/ . It is my understanding that moving the ndde dll into the unity project is sufficient to then reference it from my own scripts. All scripts compile without errors in unity. **In visual studio:** the code runs continuously and when a variable is changed on the external server an EventHandler is used to then execute other functions. This works perfectly. **In Unity:** since the code should be constantly running I have tried putting it in Update(). However when I try and run the game the editor freezes and must be force closed from the task manager. I have also tried using a co-routine but it gives the same result. Any ideas why unity is freezing and how to fix it? Is something like this possible inside of unity only? Or does my code need to be in a separate csharp application that then sends its data to unity in some other way? Thanks

Importing object type from .so lib

$
0
0
Hi, How do you import an object type into Unity? For instance, let's say I have a .so library written in C/C++ with this inside: Lib: typedef struct myObject{ // some stuff here } myObject; Then what do I do in Unity to get this back? [DllImport("mylib")] // Something? If needed, yes I've looked it up on the internet, read the Unity documentation, other threads etc... the only thing I have found was [this][1] and it didn't help me because I don't know what's inside myObject and I don't need to. Any help would be appreciated. Thanks [1]: http://forum.unity3d.com/threads/calling-c-plugin.16000/

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

using Json.NET support in 2017.2?

$
0
0
Hi! So now that 2017.2 is out and using the Mono and .NET upgrades (soon to include .NET Standard 2.0) will it be possible to use Json.NET? https://docs.unity3d.com/Manual/ScriptingRuntimeUpgrade.html At the moment I've been considering using the JSON library available in the assetstore but it's only tested up to 5.3 which means it's probably whittled down pretty badly. https://www.assetstore.unity3d.com/en/#!/content/11347 I've also checked out trying to get Nuget packages right in to Unity but it doesn't seem like a pleasant or an easily replicable process. https://www.nuget.org/packages/Newtonsoft.Json/ http://www.what-could-possibly-go-wrong.com/unity-and-nuget/ Now this last link is relatively old considering 2017.2 is now released which is what led me to this question - can we bring in Json.NET libraries now without hairpulling semantics? Bonus Round: Also, I've noticed that there are definite compatibility issues with Android/iOS. Is this still a problem?

Unity with SignalR

$
0
0
Hi guys, I'm having trouble to use signalr in unity. I downloaded the signalr package from nuget and put it in Plugins folder. It throw me error "unity error cs1703: an assembly 'newtonsoft.json' with the same identity has already been imported. consider removing one of the references" How do I solve this issue? Hopefully someone can point me to right direction. I'm using Unity 2107.1 and trying to use signalr.client v2.2.2 Thanks

Error: Failed to set the specified COM apartment state & Canon EDSDK

$
0
0
Hi~~ I am trying integrate Canon EDSDK with *Unity3D (5.6.1)* by referencing Canon EDSDK's Visual Studio project from **>>** https://www.codeproject.com/Articles/688276/Canon-EDSDK-Tutorial-in-Csharp **<<** , created by "Johannes Bildstein". In his project, it will call `thread.SetApartmentState` when creating thread. And I found that my project is not functioning after I convert the visual Studio UI to Unity UI. There are **NO** error message when testing on *Unity Editor* and Unity's log.txt file. **But** ***"Failed to set the specified COM apartment state"*** was show in *output_log.txt* after I build and run the project in .exe. ---------- After that, I try to delete the line (`thread.SetApartmentState(ApartmentState.STA);`) or change the **STA** to **MTA** or **Unknown** but the project still not functioning after build the ".exe" . However, the project is functioning in *Editor* after I modify the code. Any idea why this happening? ---------- >> More Detail: In *Johannes Bildstein's* visual studio project has a class call `STAThread` for handling `mainThread` object. To create `mainThread` object, `STAThread` has a method `CreateThread` to create `mainThread` object. public static Thread CreateThread(Action action){ var thread = new Thread(new ThreadStart(action)); thread.SetApartmentState(ApartmentState.STA); return thread; } public void Start() { lock (runLock) { if (!isRunning) { mainThread = CreateThread(ExecutionLoop); isRunning = true; mainThread.Start(); WaitForThread(); } } }

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.
Viewing all 86 articles
Browse latest View live


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