How combine Unity project as a Library with Android Project Application - c#

I have read a lot about this topic, how to integrate Android App with Unity App, and it's seem to be something really strange.
I have check post like this http://www.41post.com/5292/programming/unity-and-android-create-an-unity-app-with-a-custom-layout
which is working fine. But, in this case, the developer after export Unity Project to Android Studio, he start to develop his code inside the project that Unity has created.
This is not the same thing I have to do, I need to export Unity Project, make this a module marked as a Library and be imported for another Android Project.
Making this I have achived compile but in runtime I have different erros, some erros like "Unable to find Main", I have changed gradle and recompile with ndk to recognize .so files but is not working, when I open App it's say something like "Failure to initialize! Your hardware does not support this application, sorry!" and this have no sense because this Unity app has been tested in the same device and works.
Maybe is something that can't be done, and Im just totally lost.
Has someone make this happens?
Thanks,
Regards.

Related

Hologram is not shown in the hololens 2 while it's working in the desktop

I deploy my HoloLens 2 in Visual Studio through Release, ARM64, and Device. If I use the Release Machine instead of the Device, I got an error.
My desktop doesn't have the same Wi-Fi as my HoloLens. I can't connect my desktop and HoloLens to the same Wi-Fi.
My deploy is succeeded after I use the Device. My project Icon is shown in the HoloLens 2. But after I open the Icon, I can't see anything.
Please help me to find the solution. I spend a lot of time on this problem.
Maybe my explanation of Remote Machine and Device gave you some misunderstanding. I'm sorry about that. Remote Machine + WIFI and Device + USB are both officially recommended deployment methods. Since you have successfully deployed through Device, please continue to use it. If you are still a little confused about deployment you can publish a new thread.
It seems the main issue here is that when you run the deployed project, you cannot see any object. I recommend you try Remote Debugging(https://learn.microsoft.com/en-ca/windows/mixed-reality/develop/unity/preview-and-debug-your-app?tabs=openxr) in the Unity editor, which allows you to quickly preview and debug your project without deployment, and it can also be connected via USB. You can also use the official sample to Remote Debugging or deploy directly. Also, it's important to note that before you build your project in Unity, you need to add the scene to Build Settings->Scenes in Build.
Finally, I found the solution to my problem. Before I used the unity 2020.3.9. Now I changed the version to 2020.3.4. Now I can deploy and see the game objects in my hololens 2.
I had the same issue before. In the unity editor, I can see my models normally. But the models were not shown in Hololens, or only by one eye. The reason was that the models use the standard shader of Unity. After I applied the Mixed Reality Toolkit/ Standard Shaders, every model was shown.

How do you add manifest files to UWP projects that Unity3D builds?

I am porting a game to Windows 10 and Xbox One, which requires that I have certain manifest files in my UWP app for defining the capabilities and socket usage of the application.
I understand the uses of these manifest files; however, I do not understand how I am able to configure the manifests that are built or injected into UWP applications that Unity3D creates when building.
Specifically, I need to add the file networkmanifest.xml to my UWP app to define socket usage for use with Xbox Live. Here is a link to Microsoft's documentation on the manifest file.
Research into this area has left me drawing a blank, and I'm not sure if it is because I'm fundamentally looking at this problem wrong.
There are two good options here:
Write a script that automatically gets run after the build (using OnPostprocessBuild) and copy/inject your manifest into the generated project there.
Modify the generated Visual Studio solution and commit the files you modified to your project source control. When building your game from Unity, always build on top of the same modified project. Unity will not overwrite the changes you made.

Unity: use UWP project in unity windows standalone application

I am making a windows standalone application using unity.
I want to record video from PC webcam and save it locally. The only solution that I found is a UWP project that records video and saves it to PC.
I want to know if there is a way to use this UWP solution in my windows standalone application.
For C# projects (not UWP), I build it to dll and use it as dll in my application.
I need to find a way to do just like this with UWP project.
Edit 1:
I tried Unity VideoCapture Example in both editor and build. In unity editor, the application runs without errors but it didn't enter to this function "VideoCapture.CreateAsync()", as they said it didn't work with the editor.
When I tried to build to windows standalone build, it gives me this error :
"Assets/Scripts/Controllers/Other/VideoCaptureExample.cs(4,26): error CS0234: The type or namespace name 'WebCam' does not exist in the namespace 'UnityEngine.XR.WSA'. Are you missing an assembly reference?"
If you are using the HoloToolkit / MRTK, you had best delete that folder and use the newer asset, or better yet, use the Master Branch which has more fixes in it.
Or you can try update your Unity to 2017.2 and the sample works when testing on my machine. 

Automatize archiviation process of an app in Xamarin.Forms

The project that I'm currently developing consists in two different sub-projects: a xamarin.forms application and an aspnet core project used by the first. For now I need only the android version of it, so let us focus only on this aspect. The aspnet project should be able to provide a page where the user can download the .apk. For now I've put the .apk file in a folder in the web project directory and all works perfectly. What I want to accomplish now is to automatize this process: everytime i compile the entire solution, the system itself should prepare the apk package and put it in the right folder. At first it seemed easy, but I've not found a way to do it. Doesn't anyone have tried this, yet? Thanks!

A very complicated workaround for using a C# dll with an Android app? (xamarin)

I have an proprietary Android app (created with Android Studio) and I need to add some functionality which requires to use a C# DLL.
The app is connecting wirelessly to a development board that does some sensor measurements. Normally on windows apps the dll is used to do some complex calculations of calibration coefficients for the measuring.
My problem is:
I don't have the the source code of the DLL and most likely I won't be approved to access it.
I've read that you can use xamarin to make android apps and use C# dlls but I can't rewrite the whole app for xamarin just to use the dll (also I've never used xamarin)
So far I had the idea to build a simple http server with C# that gets parameters with a GET request, runs them through the dll and returns the results. However it's not an ideal solution because it requires a separate pc to run the server and the adndroid device to have a network connection to it.
My second idea is to build a separate app with xamarin that uses the dll and make my main app start it just to calculate the coefficients and get the results. Perhaps make the second app not visible in the launcher and somehow distribute the two apps together.
Since I am not experienced with android development and especially xamarin and I don't have a lot of time to waste on this project I want to know if my idea is feasible or if there is a better alternative.
Can you suggest some useful tutorials for xamarin and using dlls with it?
===============================================
Edit
I have managed to get the source code of the dll project which is in C++ (and full of windows only stuff) and now I'm trying to use NDK to compile it and JNI with Android studio to use the native functions. Unfortunately almost every step has it's own quirks and problems and it's far from smooth :/ I wouldn't recommend it to beginners like me!
I know this answer is late, but I'm in a similar situation right now.
This project here helped me setup a native Android Studio build with an embedded C# lib:
https://github.com/royd/KotlinAppWithXamarinDependency
The only issue I'm facing right now, that I can't get the R8 obfuscation/optimization to work without breaking the app.

Categories