Replacing Windows DLL in Unity with what in iOS? - unity3d

I'm trying to deploy a Unity test app to iOS to understand what we will need to provide to developers wishing to use our device. The device is custom hardware and shows up in Windows as a HID device over USB or BLE.
In the Windows builds the Unity script calls functions exposed in a C# DLL written targeting the "Unity 3.5 .net Subset Base Class Libraries" as required. The functions in that DLL make native calls to Windows functions like HidP_GetCaps, SleepEx, ReadFileEx, etc.
Clearly that C# DLL is very Windows specific.
The calls into the C# DLL are mainly subscribing to events. For example here's the Start method in my Unity script
void Start () {
DeviceManager.Instance.DeviceConnected += DeviceConnected;
DeviceManager.Instance.DeviceDisconnected += DeviceDisconnected;
DeviceManager.Instance.Initialize(Communication.AllSupported);
}
Unity prepares an Xcode project for me when I build this for iOS. What should I be making to replace the DLL so that Unity developers who want to write for our device can target iOS? Where do I replace the DLL calls to target this whatever-it-is?

Related

Unity - UWP Build Target support in Linux/Ubuntu

I need to run a Unity Script to generate asset bundles in a Linux/Ubuntu server. The Unity will be on that server but the assetbundles are built for UWP (BuildTarget.WSAPlayer) .
According to this thread it is not supported. But has things changed over time? Do you think newer versions of Unity will support it?
https://forum.unity.com/threads/assetbundles-linux-hololens-compatibility-issue.493271/
If it doesn't support UWP assetbundle building in Linux, that means I have no other way to create my assetbundles in a Linux/Ubuntu server and I have to go for a Windows server?

How to import uPLibrary to Unity to work with HoloLens?

I'm trying to create an MQTT client to establish a communication between HoloLens and an MQTT broker. I created a script inside the Assets folder and tried to write an MQTT client using the following libraries.
using uPLibrary.Networking.M2Mqtt;
using uPLibrary.Networking.M2Mqtt.Messages;
But how do I import these libraries to the project? I'm new to C# so I'm not aware of any build tools that can be used.
Appreciate any advice on this regards.
You need to distinguish three cases having two different DLLs:
Running on HoloLens
The native HoloLens
emulator.
Unity editor simulation i.e. Holographic Emulation or simulator (s.
Introducing Holographic
Emulation)
1 and 3 are base on UWP while Unity editor is using .NET framework (4.X nowadays). For accessing uPLibrary namespace from UWP copy the M2Mqtt.WinRT.DLL to somewhere under your Assets directory select it and edit its import settings like this:
To make things work in Unity simulator too, copy M2Mqtt.Net.DLL and edit the import settings so that Any Platforms is clicked and WSAPlayer is excluded.
You don't have to make any distinctions in code and can access MqttClient and other classes platform independent like for iOS or Android.

Compile with a windows plugin.dll for a linux plateform UNITY

I'm working for someone that develop a game on Windows with Unity.
What's happening if I'm building for him a windows plugin (.dll format) and then that he tries to compile the game for linux?
A .dll can't be read from unix systems, and Unity for windows can't load .so plugins, so what's the point?
You need seperate native plugins for each platform, it has always been the case, unless the plugin is Managed Code / c#, you need to provide windows,mac, linux, android, ios, xbox etc

Building a Unity project with the Affectiva SDK not working post build

I've been building a game in Unity using the Affectiva Unity SDK, and I can test the game out within Unity fine - the camera turns on, the SDK is called, and I get the response I was expecting.
Yet when I go to build the project, it claims it builds successfully and the camera is activated when the scene starts.. but I get no responses from the SDK. No errors or anything..
Do I need to package this up specially or something?
I suspect the issue is that you are building a 32-bit app on OS X. Is that correct? If it is, can you instead create a universal build or a 64-bit build? The Unity plugin currently only supports the following build options:
Windows 64-bit
Windows 32-bit
OS X Universal
OS X 64-bit (x86_64)
For some odd reason Unity defaults OS X builds to 32-bit. There is documentation about the build requirements on Affectiva's developer portal at the bottom of the page.

How easy is it to develop an iPhone application using MonoTouch in Visual Studio?

I know about Monotouch and I have virtual MacOS and Monodevelop/Monotouch installed.
However, is it better to build an iPhone application in Monotouch on Mac OS X or it's as easy as to build iPhone app in Visual Studio and port it to iPhone via Monotouch?
Is there anyone who tried porting c# project to iPhone? How different was it from building the app on mac os using monodevelop/monotouch?
ps. my favourite helper utilities does not exist on mac os and that's the reason for this Q
As mentioned, to compile your applications and upload them for appstore use, or debug using the simulator you'll need to use MonoDevelop on a Mac.
However it is possible to write a large portion of the code in Visual Studio 2008 or 2010.
I've written 6 Monotouch apps that are selling badly in the appstore, using primarily Visual Studio. The reason I use Windows and VS2010 is I'm a lot slower with the Mac keyboard, have my Visual Studio setup for speed, and a PC that is about twice the processing power.
Here's a few gotchas and tips:
Copy the monotouch DLLs from your Mac to Windows (search for "monotouch.dll" on the Mac), stick all the DLLs in a static place and reference them in your project. It should then compile in VS.
Make sure you keep 2 project files - a MonoDevelop and a Visual Studio one. I tried converting manually and also wrote a converter to go between the two but it breaks so often it's easier to just keep two files.
You can also convert the Mono XML documentation (it's in a different format to the Microsoft .NET XML documentation format) for Visual Studio intellisense. The link below has a download for the XML documentation I generated for Monotouch 2.1.
Avoid using a shared drive for development. This make compilation on the Mac very slow - stick to copying the files using a USB stick or ideally use an online source control site like bitbucket.org
I found it was quite fast with a single keyboard, monitor and mouse and a KVM switch going between PC and Mac.
For the layout (either XIB or C#) you'll have use your Mac, or write the bare bones in VS first.
I've written a fair amount on the process here.
You simply can't develop a MonoTouch application just using Visual Studio. You have to use the OSX tools to build the code and create the package for the phone. There's no way to work around that, and the easiest way to do it is using MonoDevelop.
What me and other developers have done in the past is to develop some of the C# libraries for the apps using Visual Studio, because even though MonoDevelop is pretty good, its still far from being as good as VS. Refactoring code, for example, is much easier with tools like Resharper, etc.
When developing the App in Visual Studio, there's a lot of things you'll have to deal with; for example:
You simply cannot run a build from Visual Studio: VS doesn't know how to build the kind of project necessary for the iPhone, and it doesn't have all the libraries that exist in the iOS SDK.
there's no visual editor to create the XIB files you you probably want to create for your app.
You'll have to do a lot of extra work here and there to get the VS to even open the solution (like copy lib files from OSX to Windows, create separate projects, etc) (although I think Novell Mono tools for VS may help a little on this one.
So here's what I've been doing for the last 6 months:
Break down the application into different projects for business logic and UI logic
You should be able to build, compile and even test the business logic from VS. Just remember not to use any UI libraries, or external libraries not available in MonoTouch
Use MonoDevelop to build the UI code part of the app. Being able to quickly run the app to test helps a lot.
Every once in a while, if you feel you need to to a big cleanup, open the code in Visual Studio, and do the refactorings; although you won't be able to build anything, the code checker in VS will help to make sure the code is still valid.
Hope it helps!
This has actually changed with new MonoTouch release rebranded as Xamarin.iOS that offers tight Visual Studio integration. You still need a Mac for building and testing but you can work from VS without much hurdle.
They even hooked up the debugger:
In this screenshot, VS and OS X run on the same computer, but they don't have to, given that there is a local network connection between them.
Read more here:
Xamarin iOS for Visual Studio allows iOS applications to be written and tested on Windows computers, with a networked Mac providing the build and deployment service.
Developing for iOS inside Visual Studio provides a number of benefits:
Creation of a single cross platform solution for iOS, Android and Windows applications.
Using Visual Studio tools (such as Resharper and Team Foundation Server) for all your cross-platform projects, including iOS source code.
Using the familiar (for existing Visual Studio developers) code editor, keyboard shortcuts, etc.
Xamarin.iOS for Visual Studio supports configurations where Visual Studio is running inside a Windows virtual machine on a Mac (eg. using Parallels or VMWare).
Note that Visual Studio integration is available in Business edition which is $999 per license.
(The license is perpetual per person but you only get free upgrades for a year.)
The MonoTouch home site states:
Please note that MonoTouch requires a
Mac, Apple's iPhone SDK and you must
be part of Apple's iPhone Developer
Program to test and deploy your
software on a device and to
redistribute your code.
I think some of the problems you are going to have using Visual Studio are
you won't be designing with the native UI controls
the emulator used for testing will be different
you may end up using API calls that aren't available in the MonoTouch libraries
I would stick with using MonoDevelop on the Mac.
Since you need the Apple's iPhone SDK (which is only available for OS X) installed to develop with MonoTouch you will be limited to developing on a Mac.
MonoDevelop is quite a good IDE, and its integration with Interface Builder and the iPhone/iPad simulator makes developing for iPhone with MonoTouch a pretty nice experience.