MRTK 2.0.0 - WMR Controller Model and Shader not included? - unity3d

The newer versions of MRTK-vNext (v2.0.0 Beta 2), don't seem to contain the ability to load the native Controller meshes & shaders. Is there anyway to get these implemented like older versions, or is this something that will be added in the -near- future? The MixedRealityConfigurationGuide states:
The MRTK does not currently support native SDK's controller models as Unity does not yet provide the capability to load / render gLTF models, which is the default type of models provided by most SDKs. This will be enhanced when this is available.
However, previous versions of the HoloToolKit seemed to have this implemented? I can understand why controllers for Oculus and OpenVR haven't been implemented yet, but why not the WMR ones. Is there anyway to add the older methods into a project running V2.0.0 Beta 2?

The main issue with the native models is with their format, Unity does not support "out of the box" gLTF models. Each SDK that uses them (including steam now) has had to write their own implementation.
The feature is coming very soon (if not merged already) in to the MRTK development branch and will be available for the upcoming RC1 release. This however, will only feature the model and not the animations (as things change), but this will also be included later.
In the meantime you can place the default Gizmo models with any other model of your choice in the "Input Settings" -> "Controller Visualisation" configuration.
Here's a quick guide to managing controllers - https://www.youtube.com/watch?v=F3e2lwqVPyc

There is an initial pull request out to address this issue:
https://github.com/Microsoft/MixedRealityToolkit-Unity/pull/3548
This functionality took longer to port based on HTK's gltf importing logic using a newtonsoft library for json serialization. Newtonsoft version conflicts paired with Unity's il2cpp compiling was generating issues for different MRTK community members. Luckily, another community member provided a unity json serialization based utility for gltf loading :)
This pull request will enable WMR controller models appearing in compiled windows/uwp applications. Additional work will be required to get these models appearing in the editor.
On github: https://github.com/Microsoft/MixedRealityToolkit-Unity/issues/3595

Related

UnityCG.cginc source code / insights on methods

So i'm trying to implement an own graphics engine with unity-like functionality in that project. I'm using hlsl in both, Unity and my own project. Now i'm transferring what i did in unity to my D3D11 project. Somehow i can't access any Unity build-in methods (still in unity) like .xyz on a half3, where i want to have insights on additional information in order to implement them properly.
Is there any way to access those methods or see how they are implemented? I tried downloading extensions for VS 2022 like "HLSL Tools for Visual Studio" or "ShaderLab VS" both didn't give me the usual option to inspect that class. Also the online documentation only tells you that there is given .xyz method, but doesn't provide any further information.

How to include Unity3d libs in a non-Unity3d project?

I'm developing a C# library that will be used either as a plugin in some Unity3d projects and also used in non-Unity3d projects.
I need to use some Unity3d classes (such as UnityEngine.Matrix4x4) and standardize some functions to use valid types agnostically to whether the project is an Unity project or not.
So, as the title says: what is the right way to include Unity3d libraries in a non-Unity3d library project? Should I just include reference to the local Unity3d binaries (like UnityEngine.dll) in my project? If so, which is the right folder to look for these binaries (they appear in some different folders in the unity installation folder)?
If you are not actually running the Unity Engine for rendering or handling input it may be the case of forcing a round peg into a square hole, both technically and legally.
The most elegant solution would likely be to write your library in C# using more agnostic libraries. For example the Matrix4x4 class you mentioned has an equivalent in System.Numerics. Alongside the library all thats needed is a light wrapper converting a System.Numerics.Matrix4x4 to a UnityEngine.Matrix4x4. Sometimes the Unity devs themselves do stuff like this, for example the Unity.Mathematics.float3 struct which works better in ECS land than a standard Vector3.
FYI if you're looking for how some particular system works, check out the C# Reference GitHub Repository, for example the Matrix4x4 struct. Just be aware that 'copying and pasting' Unity source code is not allowed.

TypeLoadException after loading .NET 4.5 C# DLL into Unity 2018.2.5

I want to be able to feed the camera frames from a webcam into Unity. I made a .NET 4.5 C# DLL using MediaFrameReader and event listeners. Here is some other user's implementation for accessing the Hololens camera frames: Hololens - Access Camera Frames.
When I import the DLL into my 2018.2.5 Unity project, it gives me the following error:
Unloading broken assembly "....", this assembly can cause crashes in the runtime
TypeLoadException: Could not find method due to a type load error
The C# plugin built successfully many times on Visual Studio. Also, I have properly set the Api Compatibility Level (in player settings) to .NET 4.x. What could be the fix to this?
All the other SO answers related to this I have already taken a look, but does not seem to help the problem. Thanks for all the help.
EDIT: https://issuetracker.unity3d.com/issues/unity-fails-to-load-net-4-dot-6-assemblies-with-typeloadexception is the most relatable post, but had no solution.
I have few possible solutions for you to explore.
DLLs issues:
Workaround:
Comment your UWP code (the part that uses the DLL), then build it in UNITY without the DLL. In the generated UWP solution, install the package from nuget or manually import the dll, then uncomment your code and finish your development. This is a short-term solution.It is going to be annoying as you re-build your solution many times and have to comment/uncomment then re-add dlls and so on.
Other possible solutions:
Failed to run reference rewriter with command error with unity error when adding a DLL to the assets folder
Your exact need
From your description, you really do not need everything in the link you referenced (Hololens - Access Camera Frames). You need much simpler version. I recently created MediaCapture solution for HoloLens as a workaround because PhotoCapture in Unity is not working in the HoloLens and everything is working without any additional DLLs. I will post for you few links to see if it may help you:
MediaCapture Unity & HoloLens: https://github.com/MSAlshair/HoloLensMediaCapture
This maybe a good start for you. You can combine it with your original reference. Use this project as starting point to make sure your project is building correct, then use the necessary code from the other resource that you posted to accomplish the task that you desire. You may need to download Unity 2018.2.12f1 because I didn't test it in 2018.2.5
MediaCapture & PhotoCapture: Hololens font camera
Good Luck!

Can F# be used with Unity (game engine)?

I'm getting into Unity, and wondering if I can use F# instead of C#, simply because I prefer the syntax. I'm guessing not, since the environment it runs on is very different, but maybe there's something that will cross-compile code or something else I'm not thinking of.
I can't help but get the impression that the other answers were written by people who do not really know what they are talking about.
This is what you need to do to use F# in a Unity project:
Create an F# project that compiles into a dll. Have it build into the assets folder of a Unity project.
Add references to UnityEngine.dll and/or UnityEditor.dll. Change the reference properties so the dlls aren't copied to the build folder.
Of course you can't create new F# classes from within the Unity editor this way, but you can assign the ones you wrote in F#.
Currently you need to enable the (experimental) support for .NET-version 4.5. Alternatively you can download an older version of the FSharp.Core.dll that supports .NET 3.5. (see here).
I can't guarantee that you won't run into trouble because of compatibility issues with the FSharp.Core.dll, but that's just a guess since I haven't tested it myself.
I had success doing this sometime back by following this Github project: https://github.com/eriksvedang/FSharp-Unity, which I believe is roughly the same as Lars Kokemohr's answer above. I haven't tested it in more recent versions of Unity/Mono however.
Yes you can use F# as first class language as C# in unity.
Here is an article about it link
an excellent blog for One who want to use F# in unity
if you want to use F# as second class which I recommend.
let me show how to do it.
Usually what I do is to create Game Domain in F# in .net standard
2.0 library project build it.
Make unity API Compatibility level .net standard 2.0 then
Import library project dll in asset/plugins in Unity
Here is an explanation on how to do it automatically after each build : link
You will get this error, here is the solution
Having said that I recommend not to do any serious work in unity with F# because you won't be able to cross compile to other platforms.
Unity uses IL2cpp and it don't work with F#.
In simple words unity don't support F# and if you are having issues like bugs in Il2cpp unity will not fix it because they don't support F#
There is no easy way to do this but if you REALLY want to make it happen I believe you could use something like fs2cs:
https://github.com/hsharpsoftware/fs2cs
In theory you could write a script that calls fs2cs on all of your Unity C# files. Integrating this with Unity itself would be the more challenging part, but in theory you can trigger fs2cs transpilation on save of your file and Unity can use the transpiled C# file.
Only Boo, C#, and UnityScript are officially supported!

blackberry cascades mapview

Hi I am trying to implement a mapview using blackberry cascades based on this link but whenever I import maps
import bb.cascades.maps 1.0 ,
the QNX IDE throws out an error saying
bb.cascades.maps is not installed.
I have set up the environment exactly as described in the developer site and dont seem to understand how do i install this module.
They seem to have left out some steps. Not all cascades objects are loaded by default into the development system, but they can be added at runtime. The biggest drawback is that the Eclipse can't do static analysis of the QML for errors only general syntax.
If you add the following lines to the main.cpp file you may get the example to work (I hacked this into one of my current projects and got it to load without errors but the MapView is all black):
#include #include <bb/cascades/maps/MapView>
Then just before the QmlDocument::create call:
qmlRegisterType<bb::cascades::maps::MapView>("bb.cascades.maps", 1, 0, "MapView");
This is the mechanisim that is used quite frequently to make Cascades objects not included in the default setup available, or to make your own specializations from CustomControl or other Cascades objects available to QML.
Finally this example seems to pre-date beta 3 so there may be some other issues that you may have to work through.
EDIT
I did some poking around and found this thread on the BlackBerry forum. Setting the altitude to 10000 actuall got me a usable map on the simulator and the Dev Alpha. It obviously needs more work but you can interact with it (drag to move, pinch to zoom, etc).
The MapView component seems to have been largely unusable until the most recent SDK update (10.0.9.2318), as somewhat admitted and referenced by this Blackberry DevBlog post:
http://devblog.blackberry.com/2013/01/cascades-mapview/
Also, check out the new CustomMapView example on Github for a working sample app using this latest update:
https://github.com/blackberry/Cascades-Samples/tree/master/custommapview
For the QML preview issue, this is known issue. QML Preview currently only supports the core cascades components. See my more detailed answer here:
blackberry 10 Unresolved inclusion <QObject>