Quantcast
Channel: Questions in topic: "native plugin"
Viewing all 376 articles
Browse latest View live

how to open Add To Contact with unity?

$
0
0
i checked some post where there is some trick to open dial pad directly with Application.Openurl(tel:[555555555]); to send sms: Application.Openurl(string.Format("sms:{0}?body={1}",mobile_num,message)); same way how to do for AddContact if i pass name and number it should open Add To contact page of android that have name and number filled in it

Plugin external method every frame

$
0
0
Hey, I'm calling an external method following https://docs.unity3d.com/Manual/NativePlugins.html every frame on Update (). The problem is, the native position update is not in Sync with the underlying Unity rendering. It looks like the hotspots are stuttering because they are one or more frames behind. Is that expected? Is there any way to call it synced not asynced? [DllImport ("__Internal")] private static extern void nativeViewUpdateHotspot(string name, float x, float y); - extern "C" { void nativeViewUpdateHotspot(const char* name, float x, float y, float percentage, float direction, float distance) { … [hotspotsViewController updateHotspot:[NSString stringWithUTF8String:name] x:CGFloat(x) y:CGFloat(y) ]; } }

Native Plugin Cleanup

$
0
0
I'm writing a native plugin for Windows in C++ and having some trouble with the development process. Because Unity doesn't release the plugin dll after running it once, it is necessary to close Unity before I can modify the dll. This is obviously not ideal, so as a work around I [manually load and release](http://runningdimensions.com/blog/?p=5) the dll in a script at runtime. This works for simple plugins, but for plugins that hook into Unity's rendering system I've been finding that calling `FreeLibrary` from `OnApplicationQuit` isn't safe because the OpenGL thread might continue running afterwards. For instance, if I call glDebugMessageCallback(), and I unload the library, the callback function is no longer valid. I can't unregister this callback in OnApplicationQuit because I need to be on the rendering thread to do so. Here is the stack trace: > 00007fff914403f0() <- Missing function nvoglv64.dll!0000000072b40617() nvoglv64.dll!000000007290feec() Unity.exe!GfxDeviceGLES::BeginProfileEvent(class ProfilerInformation *) Unity.exe!GfxDeviceWorker::RunCommand(class ThreadedStreamBuffer &) So my problem basically boils down to: where should I free my dll if not in `OnApplicationQuit`?

Are native plugins only supported on Unity Pro?

$
0
0
I know this was the case previously but I read somewhere that since Unity 5.x native plugins are supported in all versions.

Editor crash "allocation 0x0xc000000000000000 already registered"

$
0
0
I am trying to integrate [libfreenect2][1] and [freenect2.net wrapper][2] but I am getting a strange crash that only happens in the Linux editor for my main project. The Windows editor, and Windows and Linux standalone all work fine. I am using editor version 2017.2.0f3. The crash happens almost instantly after I call `device = new Device(0);` to initialize the Kinect device. There is an error in the console, then the editor itself closes. I tried copying just the code that interacts with the Kinect to a new project, and it worked there. How can I find the cause of the crash? Or am I stuck copying pieces one at a time to a new project until it starts crashing? Relevant bits of scripts: //KinectManager2.cs void Start () { depthSources = GetComponents(); Array.Sort(depthSources, delegate (DepthSourceBase a, DepthSourceBase b) { return a.Priority.CompareTo(b.Priority); }); foreach (DepthSourceBase source in depthSources) { if (source.enabled && source.InitDepthSource()) { activeDepthSource = source; break; } } } //KinectTwoDepthSource.cs public override bool InitDepthSource() { try { if (Device.Count > 0) { device = new Device(0); foundKinect = true; Width = device.DepthFrameSize.Width; Height = device.DepthFrameSize.Height; raw = new float[Width * Height]; averageDepth = new float[Width * Height]; averageDepthCount = new int[Width * Height]; for (int i = 0; i < depthBuffer.Length; i++) { depthBuffer[i] = new float[Width * Height]; for (int j = 0; j < depthBuffer[i].Length; j++) { depthBuffer[i][j] = float.NaN; } } device.FrameReceived += Handle_KinectTwo_DataReceived; return true; } } catch (DllNotFoundException) { } return false; } Here is the Editor.log from right before initializing the device. I'm not sure why it is complaining about the .so files, since they are all in `Assets/Plugins/Libfreenect2/Linux` and it must find them if it gets past `if (Device.Count > 0)` Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so /home/builduser/buildslave/unity/build/Editor/Platform/Linux/UndoPlatformDependent.cpp:SetUndoMenuNamePlatformDependent [Info] [Freenect2Impl] enumerating devices... [Info] [Freenect2Impl] 14 usb devices connected [Info] [Freenect2Impl] found valid Kinect v2 @4:13 with serial 006147365347 [Info] [Freenect2Impl] found 1 devices Found device UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) KinectTwoDepthSource:InitDepthSource() (at Assets/Script/Kinect/KinectTwoDepthSource.cs:85) KinectManager2:Start() (at Assets/Script/Kinect/KinectManager2.cs:30) (Filename: Assets/Script/Kinect/KinectTwoDepthSource.cs Line: 85) Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/Libfreenect2/Linux/libfreenect2c.so [Info] [Freenect2DeviceImpl] opening... [Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792 [Info] [Freenect2DeviceImpl] opened Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/x86_64/libfreenect.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/x86_64/libfreenect.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/x86_64/libfreenect.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/x86_64/libfreenect.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/x86_64/libfreenect.so Fallback handler could not load library /home/adminz/Downloads/unity-editor-2017.2.0f3/Editor/Data/Mono/lib/libAssets/Plugins/x86_64/libfreenect.so The specified identifier (BoxDimensions) does not exists. please use Exists () to check for existent before calling Load. returning the default(T) instance. UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:LogFormat(LogType, String, Object[]) UnityEngine.Debug:LogWarningFormat(String, Object[]) BayatGames.SaveGameFree.SaveGame:Load(String, String, Boolean, String, ISaveGameSerializer, ISaveGameEncoder, Encoding, SaveGamePath) (at Assets/BayatGames/SaveGameFree/Scripts/SaveGame.cs:624) BayatGames.SaveGameFree.SaveGame:Load(String, String) (at Assets/BayatGames/SaveGameFree/Scripts/SaveGame.cs:439) CalibrationManager:Start() (at Assets/Script/Calibration/CalibrationManager.cs:146) (Filename: Assets/BayatGames/SaveGameFree/Scripts/SaveGame.cs Line: 624) InvalidCastException: Specified cast is not valid. at CalibrationManager.InitTextureDisplay () [0x000d6] in /home/adminz/AR-Sandbox-master/Assets/Script/Calibration/CalibrationManager.cs:256 at CalibrationManager.Start () [0x00653] in /home/adminz/AR-Sandbox-master/Assets/Script/Calibration/CalibrationManager.cs:233 (Filename: Assets/Script/Calibration/CalibrationManager.cs Line: 256) allocation 0x0xc000000000000000 already registered @ /home/builduser/buildslave/unity/build/Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:l234 size 24000; now calling from /home/builduser/buildslave/unity/build/Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:l234 size 3000? (Filename: /home/builduser/buildslave/unity/build/Runtime/Allocator/MemoryManager.cpp Line: 1464) Receiving unhandled NULL exception #0 0x007fb6d22aeac0 in funlockfile #1 0x007ffeb1f58920 in _nv042glcore #2 0x007ffeb1f58960 in _nv042glcore #3 0x007ffeb1f58a70 in _nv023glcore #4 0x007ffeb1f58ab0 in GfxDeviceGLES::DrawBufferRanges(GfxBuffer*, VertexStreamSource const*, int, DrawBuffersRange const*, int, VertexDeclaration*, ShaderChannelMask, unsigned long, bool) #5 0x007ffeb1f58b80 in GfxDeviceGLES::DrawBuffers(GfxBuffer*, VertexStreamSource const*, int, DrawBuffersRange const*, int, VertexDeclaration*, ShaderChannelMask) #6 0x007ffeb1f58c00 in UI::Canvas::DrawRawMesh(UI::Batch&, GfxBuffer*, GfxBuffer*) #7 0x007ffeb1f58c90 in UI::Canvas::RenderOverlays() #8 0x007ffeb1f58ce0 in UI::CanvasManager::RenderOverlays(int) #9 0x007ffeb1f58d30 in RepaintController::RenderGameViewCameras(RenderTexture*, int, RectT const&, Vector2f const&, bool) #10 0x007ffeb1f58e30 in EditorGUIUtility_CUSTOM_INTERNAL_CALL_RenderGameViewCamerasInternal(MonoObject*, int, RectT const&, Vector2fIcall const&, unsigned char) #11 0x007ffeb1f58e90 in (Unknown) #12 0x007ffeb1f58ea0 in (Unknown) #13 0x007ffeb1f58eb0 in mono_get_jit_info_from_method #14 0x007ffeb1f597c0 in mono_g_hash_table_print_stats #15 0x007ffeb1f597f0 in mono_runtime_run_main #16 0x007ffeb1f598a0 in mono_unity_register_path_remapper #17 0x007ffeb1f59970 in (Unknown) #18 0x007ffeb1f59980 in (Unknown) #19 0x007ffeb1f59990 in (Unknown) Launching bug reporter [Unity Package Manager (Upm)] - Application terminated due to HTTP connection being closed on the other end. [1]: https://github.com/OpenKinect/libfreenect2 [2]: https://github.com/thomiel/freenect2.net

Audio Spatializer Plugin SDK: how can plugin get channel count of input audio source?

$
0
0
Hello Unity friends! I am working on a Spatializer plugin and my plugin DSP code and I understand that Unity passes audio to my plugin as stereo, regardless of whether the underlying audio Clip is mono, stereo or multi-channel, by up or down-mixing as necessary. So given that my plugin will always "see" audio as stereo, how can I access per instance (i.e. per audio source) info on e.g. channel count of the source. The documentation on spatializer instance data includes the following: struct UnityAudioSpatializerData { float listenermatrix[16]; // Matrix that transforms sourcepos into the local space of the listener float sourcematrix[16]; // Transform matrix of audio source float spatialblend; // Distance-controlled spatial blend float reverbzonemix; // Reverb zone mix level parameter (and curve) on audio source float spread; // Spread parameter of the audio source (0..360 degrees) float stereopan; // Stereo panning parameter of the audio source (-1: fully left, 1: fully right) // The spatializer plugin may override the distance attenuation in order to // influence the voice prioritization (leave this callback as NULL to use the // built-in audio source attenuation curve) UnityAudioEffect_DistanceAttenuationCallback distanceattenuationcallback; }; I would have thought that a channel count in this struct would be useful. So is there a way to infer the mono/stereo/multi channel nature of the audio source from the above? (e.g. maybe stereopan is set to a specific value for mono sources?) It seems I must be missing something here because it's clear that a spatializer would want to spatialize an audio source differently depending on its number of channels. Thanks!

Native DLL saying FileNotFoundException

$
0
0
I'm trying to use the C# library clrzmq which is a library for ZeroMQ messaging. There's a .NET specific one but I'm unable to get it to work in Unity 2017. My script for clrzmq works fine in standalone Visual Studio 2017. I put it into Unity and once I run it I get FileNotFoundException: UnmanagedLibrary[libzmq] Unable to load binary "libzmq" from folders C:\Program Files\Unity\Editor\amd64\libzmq.dll C:\Program Files\Unity\Editor\x64\libzmq.dll C:\Unity Projects\unity\Assets\ZeroMQ\amd64\libzmq.dll C:\Unity Projects\unity\Assets\ZeroMQ\x64\libzmq.dll I've tried copying the file to a number of those other folders. Same error. I put it under Assets, Assets/Plugins and even the Unity editor folder. No dice on any of them. Ideas?

Are calls to C++ DLL handled asynchronously?

$
0
0
Hi everyone, When I call an imported function (from a C++ DLL), will Unity stall until the function finishes executing, or will it still run asynchronously? The dll does some extensive computing that takes 30-100ms, and I don't want the program to lag during that time. Thanks in advance!

How to Control iOS device volume with Unity?

$
0
0
I developed Enterprise App, and installed it to my iPad. the problem is that the iPad will be built in the wall, so it will not be possible to control volume button. I want to control the volume button during the exhibition. I made UIButton "-" and "+" to control the volume of the device instead of real volume button, not the Unity audio component's volume. I researched several times, so know what to do in Unity. using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Runtime.InteropServices; public class IOSManager : MonoBehaviour { public static IOSManager _instance; [DllImport("__Internal")] private static extern void iosVolumeMinus(); private static extern void iosVolumePlus(); void Awake(){ _instance = this; } public void CallMinusFunc() { iosVolumeMinus(); } public void CallPlusFunc() { iosVolumePlus(); } } Well, I tried somethings and realized that MPMusicPlayerController And MPVolumeView may work, but had some problems. ![alt text][1] If I use MPMusicPlayerController, alert : 'volume' is deprecated: first deprecated in iOS 7.0 - Use MPVolumeView for volume control. If I use MPVolumeView, alert : Incomplete definition of type 'struct objc_class'. It is my first time to develop iOS app, so I don't know what is the problem. please help me.. [1]: /storage/temp/110297-captured.png

Build Linux plugin with a PC

$
0
0
https://github.com/unity3d-jp/FrameCapturer For some reason, i need to compile a Linux Unity build with this plugin and run it on AWS. The plugin part says it can work in Linux but it need me to compile it myself. But the problem is, i have experience on linux. I only develop with PC and Mac, and i don't build plugin myself. So how should i start?

How unity works with native Mobile applications?

$
0
0
Hi, I am working on a native mobile application.I have one functionality in my app deals with a lot of animations.Its a dynamic character movement according to inputs.In my thoughts, unity might be better option to do this.but none of the other features in my app needs unity .those are easy to do with native functionalities of iOS and Android and hard to do with unity.Can anyone suggest how can I implement unity in my app just for one functionality? do unity has some plugin that works with native applications. Any help will be appreciated! Thanks, Anu

Can't open device camera with Native plugins using OpenCV and c++.

$
0
0
Hi, I breack my head trying solving this problem but I couldn't, so I post it here for help. I am trying to use Native plugins to use OpenCV libraries and using c++ language with unity. I created CallNativeCode file which invokes another file which is the native plugins "HandGestureNative.cpp". Inside "HandGestureNative.cpp" I am trying to create VideoCapture and open the camera, but the camera is not openning. I made sure that all the opencv dependeinces file has been delared in the file. Please check the following code inside the "HandGestureNative.cpp": ** #include "HandGestureNative.h" #include //opencv #include #include "opencv2/imgcodecs.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/videoio.hpp" #include #include #include #include //C++ #include #include using namespace cv; using namespace std; // Global variables Mat temp; float result = 0.0; #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "HandGestureNative", __VA_ARGS__)) #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "HandGestureNativex`", __VA_ARGS__)) extern "C" { float HandGestureNative::HandGestureCall() { //Creating camera and assign it to camera 0; VideoCapture capture; capture.open(0); capture >> temp; if (capture.isOpened()) { result = 5.5; } else { result = 1.5; } return result; } } ** Always the return result is 1.5, which means that the camera is not open. Please help and Thank you :).

Can we safely use native texture pointers with multi-display?

$
0
0
Hi there, My application happily uses native texture pointers (OpenGLCore, OpenGL2, D3D11 and D3D9) with single displays. However, when going **multi**-display (D3D11), Unity (5.6.1, 5.6.2) freezes as soon as my native plugin does its job of creating a texture and gives a pointer back to my Unity app for use ( `Texture2D.CreateExternalTexture()` ). I suspect an issue about contexts, but I can’t be sure. 1. Does the `Display.activate()` function create one context per screen, using D3D11? 2. Same question for OpenGLCore. 3. Is there any way I can get more info about such a freeze? [EDIT] Some precisions: - Indeed, `Texture2D.CreateExternalTexture()` crashes Unity (seen in debugger). I'm giving it a D3D11 texture (resource) pointer created with the device/context I had upon plugin event call ( `GL.IssuePluginEvent()` ). - Multiple displays are not supported under Windows OpenGLCore, a Unity error message said. Any ideas?

Plugins being forced to Native even though they are managed

$
0
0
I have a project working fine on one Mac that I am trying to get working on a different Mac. I pull the git repo down and when I open it in unity a few of the plugins are set to Native even though they are managed. I have been searching for any way to change this and can't figure out how to get these imported the same way they are on the other Mac that runs everything fine. I am using unity 5.6.1 on both machines and they are both running the same version of OS X. I have tried importing this project fresh about 5 times and it's always the same result. Is there any way to change a plugin type?

How do you use a class from a .dll file?

$
0
0
I'm trying to use a class, "DevIO", from a Microchip library, "MCP2210-M-dotNet2.dll". When I downloaded the library, it had a managed and unmanaged folder, but Unity is reading both of them as native plugins. Supposedly, DllImport is used to access methods from a native plugin, but how do I access a class? UPDATE: Previously, I did have "MCP2210-M-dotNet2.dll" in a Plugins folder. I added it to the Assets folder as suggested. I then had to manually edit the project references in MonoDevelop and browse to add it as a .Net Assembly. Now "using MCP2210" is recognized, and there are no errors in MonoDevelop, but Unity still has errors. I read more into how to use the library, and it requires Microsoft Visual C++ 2010 Redistributable Package or the inclusion of "msvcp100.dll" and "msvcr100.dll". However, Unity says they aren't valid .Net Assemblies, so is there a way I can include the Microsoft Visual C++ Redistributable Package in Unity?

Native plugin dependencies

$
0
0
My native C++ plugin isn't loading because of missing (undefined) symbol: Unable to load library '/data/app/com.remap.NdnRtcTest-1/lib/arm/libNdnRtc.so', native render plugin support disabled: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "SL_IID_ENGINE" referenced by "/data/app/com.remap.NdnRtcTest-1/lib/arm/libNdnRtc.so"... I added **libOpenSLES.so** to **Assets/Plugins/Android/armeabi-v7a** folder, but it doesn't help. Any ideas?

Can we use native OS X app as UI with Unity?

$
0
0
Hi everyone, I'm working on a OS X app with Unity, and I'd rather not use Unity canvas, instead I would like to use a native custom made OS X app built with XCode. The UI would be full objective-C code and I would use Unity as a 3D rendering engine. I'm not sure if this is actually possible, I didn't found any example of someone managing this. A basic example would be as follow: Basic window with a single button made in XCode. Unity in an other window. When the button is pressed it triggers an event in Unity (change the color of a gameobject...) I got a plugin working (created as a bundle with XCode), but i don't have a clue about how I can link the plugin (bundle) with the UI (app), and have both way communication with the UI and Unity. Did anyone managed to do something like this before? Thanks!

Editor freezing with multithreaded DLL native plugin in Release but not in Debug

$
0
0
I have a DLL with a native plugin that runs a very time consuming infinite loop which runs in a separate thread to avoid freezing the main Unity rendering thread. Everything works flawlessly when I compile and run my DLL in Debug mode, but if I compile it in Release, it runs perfectly fine the first time in the editor but if I press play again, everything freezes (Start is never even called the second time, neither is UnityPluginLoad). I'm at the end of my rope with this issue and any help would be greatly appreciated. And now for the technical details, a dumbed down version of my architecture. I used SWIG to create an interface between my C++ code and C# code. The interface itself has nothing really fancy going on and there is absolutely no extra SWIG magic needed to get it to work. On the Unity side I'm doing: public class myBehavior : MonoBehaviour { private myDLLInterface m_interface; private delegate void eventCallbackDelegate( int eventID ); eventCallbackDelegate m_eventCallback = null; void OnDestroy() { StopCoroutine( "CallPluginAtEndOfFrames" ); m_interface = null; } IEnumerator Start() { m_interface= new myDLLInterface (); m_eventCallback = new eventCallbackDelegate( m_interface.updateFrameDataOGL ); m_interface.run(); yield return StartCoroutine( "CallPluginAtEndOfFrames" ); } void Update() { } private IEnumerator CallPluginAtEndOfFrames() { if( m_eventCallback != null ) { while( m_poseEstimator != null ) { // Wait until all frame rendering is done yield return null; GL.IssuePluginEvent( Marshal.GetFunctionPointerForDelegate( m_eventCallback ), 1 ); //Play can stop in the middle of coroutine. if( m_interface!= null ) { doStuff(); } } } } } And this is what's happening inside my DLL: myDLLInterface::~myDLLInterface() { if( m_loopRunner) { m_loopRunner->stop(); while( m_loopRunner->isWorking() ) ; delete m_loopRunner; m_loopRunner= NULL; } } void myDLLInterface::run() { std::thread t( &TheLoopRunner::run, m_loopRunner); t.detach(); } void SolARPoseEsimatorDllInterface::updateFrameDataOGL( int eventID ) { if( m_loopRunner->tryLock() ) { doStuff(); m_loopRunner->unlock(); } } And finally, in my TheLoopRunner, this is happening: TheLoopRunner has member variable: std::mutex m_myMutex; TheLoopRunner::run() { m_runLoop = true; m_isWorking = true; while( m_runLoop ) { doExpensiveComputations(); m_myMutex.lock(); updateOutput(); unlock(); } m_isWorking = false; } void TheLoopRunner::stop() { m_runLoop = false; } bool TheLoopRunner::isWorking() { return m_isWorking(); } bool TheLoopRunner::tryLock() { return m_myMutex.try_lock(); } void TheLoopRunner()::unlock() { m_myMutex.unlock(); } I also tried not detaching the thread, and storing it in a `std::thread*` member variable and deleting it in the `myDllInterface` destructor (with or without joining before deleting) , but the behavior remains the same. What happens in Debug that allows this to work 100% of the time and waht happens in release that stops this from working 100% of the time?

Detect if game is edit in play mode or player mode, which is built app, on native plugin

$
0
0
Hi, I'm wondering if there is any way to find out if it is in **edit in play mode** or **app** on **native plugin** without communicating with managed code. I've searched for native interfaces but seems it doesn't provide any callbacks to get those status. Any ideas...? If Unity doesn't have any interface for that, any workarounds would be great!! Thank you

How to access USB on Linux

$
0
0
I'm trying to access a USB device from Unity. There are some additional hurdles as the finished game is supposed to run on a Linux machine continuously reading input from the device (which is plugged into a USB slot on the motherboard). I've got code for reading and interpreting information passed from the device, it's VendorID and ProductID so I don't need to reverse engineer anything, just access it. Another game made for the device (c++) uses built in Libusb library that is already in linux. It references #include and gets access like this: usb_init(); usb_find_busses(); usb_find_devices(); for (bus = usb_busses; bus; bus = bus->next) { for (dev = bus->devices; dev; dev = dev->next) { if ((dev->descriptor.idVendor == vid) && (dev->descriptor.idProduct == pid)) { return dev; } } } Than it keeps reading from this device: usb_interrupt_read(handle, 1, (char*)Inbuf, PKT_SIZE*NUM_MATS, 50); Inbuf then is interpreted as the game inputs. I've got libraries: libusb (written in C++, so it's a native plugin in Unity) and c# wrapper for it libusbdotnet . With that and IDs for that device I should be able to access it (as a test I could crash Unity accessing a USB keyboard... on a PC Windows machine). But, when I compile a Linux build from Unity, the libusb.dll native plugin is dropped. There is not even an option to keep it for Linux in plugin inspector. Even If I manually add it to the build to Plugin directory it doesn't load and game throws missing dll file. Libusb is already on the OS on the Linux machine. Can I somehow access that library from Unity? Or is there a way to "sneak in" the .dll with the Linux build? Or Am I going about it ass-backwards and it should be done in a completely different way?
Viewing all 376 articles
Browse latest View live


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