Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

code in language other than C#?

edited August 2016 in Questions And Answers

This might be an obvious question, but are there any other options of language for Hololens scripting other than C#?

Also, there's no way to integrate an API that uses .NET v4.0 into Unity, correct? Since it uses 3.5? Is there another program I can use other than Unity to create a Hololens app, so I'd be able to use the API?

Thanks so much for any help!!

Best Answer

Answers

  • Options

    @ckesterson to integrate a .NET v4.0 API into a unity project you use #if statements so that the API call is ignored by the Unity editor as described here.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options
    edited August 2016

    @HoloSheep I tried surrounding the code in #if UNITY_METRO && !UNITY_EDITOR and #endif, but I'm still getting the same error in Unity when I try to build-- "error CS0246: The type or namespace name 'the_dll_name' could not be found (are you missing a using directive or an assembly reference?)" I no longer get any errors in MonoDevelop, just warnings about the .NET version mismatch.

  • Options

    @ckesterson,
    If you decide to go the C++/DirectX route, you might want to try using Unreal4, which will provide a physics and graphics engine for you (like Unity). The Xbox team created a version of Unreal4 on GitHub which supports UWP development:
    https://forums.unrealengine.com/showthread.php?118375-Unreal-Engine-4-is-available-for-Win10-UWP-app-dev-now

  • Options

    @Dwight_Goins_EE_MVP I will admit that I am very new to every part of this development-- VIsual studio, unity, using .dll's, C#... a lot of these are things I have never used before taking on this project. Most of what you said was a little over my head. I did look into SharpDX, but that looks like it mainly for graphics, correct? I don't need anything graphics-wise from the .dll, I just want to be able to make calls to methods in the dll and get the JSON results back. I just need to know how to be able to make these calls so that Unity likes it (or ignores it, whatever is easiest). My code currently compiles in Visual Studio, it's just getting it past Unity that seems to be the tricky part due to the .NET mismatch.

  • Options
    edited August 2016

    Yes @ckesterson ,

    SharpDX is the library for interacting with the DirectX Graphics engine. If you are new to this I would stick with Unity development for now. This will be your quickest route to success.

    So the easiest way to build your logic is to create a library project in VS.Net 2015 and target .Net 3.5. In this library use the System.Web assembly and namespace to create your HttpWebRequest object, send your request, and use the NewtonSoft assemblies to parse your JSON result. Look up .Net 3.5 samples and code from bing and stackoverflow. (i.e. http://stackoverflow.com/questions/22397865/call-web-apis-in-c-sharp-using-net-framework-3-5)

    After you have your logic working, add this code/library into Unity either through copy/paste, or add a reference to your project which is a more complex topic

    Dwight Goins
    CAO & Founder| Independent Architect | Trainer and Consultant | Sr. Enterprise Architect
    MVP | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer
    http://dgoins.wordpress.com

  • Options
    HoloSheepHoloSheep mod
    edited August 2016

    @ckesterson said:
    @HoloSheep I tried surrounding the code in #if UNITY_METRO && !UNITY_EDITOR and #endif, but I'm still getting the same error in Unity when I try to build-- "error CS0246: The type or namespace name '-------------' could not be found (are you missing a using directive or an assembly reference?)" I no longer get any errors in MonoDevelop, just warnings about the .NET version mismatch.

    It sounds like you are calling something called "---------------" in your code somewhere but do not have a Using statement and/or a project reference to a library that has that type defined in it.

    Can you tell us a little more about the "-------------" call? Is that something you are calling in your code somewhere? Is it coming from a secondary .dll? If it is a .dll, did you include a reference to it in your UWP project and do you have a Using statement for it?

    Note that if it is a UWP library (.NET 4.x), you will also want #if statement around the Using statement.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options

    @HoloSheep I do have a using statement, and I added a reference to the .dll in unity, visual studio, and monodevelop. All three are now giving me the same error, and then a warning: "The primary reference "the_dll_name" could not be resolved because it has an indirect dependency on the framework assembly "System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "the_dll_name" or retarget your application to a framework version which contains "System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089."

    This is what caused me to look further into the .NET compatibility. As I'm not building the .dll myself, I've downloaded it pre-built, I'm not sure I can change the .dll to be a different framework version.

    The error is coming from the #using the_dll_name line at the top of my code, which I then reference later to make an object of a type included in the .dll.

    Hopefully that answers all of your questions :)

  • Options

    @ckesterson if the dll is compatible with the HoloLens (if it will run in UWP) then I believe you should be able to just wrap that Using statement in the same conditional #if so that only the UWP app makes use of it.

    However, if the dll is not compatible with UWP and it is not something you built then you may have a problem and may need to look at other ways to get the desired functionality like building your own UWP version of the functionality that you need from that dll so that it will run on the HoloLens.

    HTH.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options

    @HoloSheep this may be a stupid question (please keep in mind that I'm very new to this), but is there a way to know if a dll will run in UWP? I downloaded it from a site that described it as a "Pre-compiled windows binary." Would mean that it will run in UWP?

    Thanks!

  • Options
    edited August 2016

    @Dwight_Goins_EE_MVP it's an API I've downloaded, pre-compiled for me. I don't believe I would need an HttpWebRequest object, because I shouldn't be getting anything off of the internet at this point :/ I'm employing NewtonSoft already to parse the JSON output, so thank you for letting me know I'm at least on the right track with that one! I still just need a way to get this v4.0 to interact with my v3.5 project... Although I'm looking back at where I downloaded the API from, and it also has a Cloud API that is REST-based. I guess if I did that then I could make use of your HttpWebRewuest object suggestion... do you think if that I did, that it would get rid of the .NET issues I'm having currently? Or do you think that using something like WWW would be a better fix, as it's a unity-specific class instead of using .NET? Or maybe WebClient, since I need to send AND recieve data, not just request it?

    Thanks so much for all of your help so far, I really, really appreciate it!

Sign In or Register to comment.