I don't know how to call using UnityEngine.XR.ARFoundation in a C# script inside my own Package in Unity - unity3d

I don't know how to call using UnityEngine.XR.ARFoundation in a C# script inside my own Package in Unity.
I have added ARFoundation in Dependencies of Package as shown in the image. But I'm getting "error CS0246: The type or namespace name '~' could not be found (are you missing a using directive or an assembly reference?)". How can I resolve this?

I solved the problem by creating Assembly Difinition Files in my own package and adding references to Assembly Difinition References.

I fixed this issue in "Edit" ... "Preferences" ... "External Tools", by checking "Regenerate Project Files"; this hopefully regenerates all the necessary ".csproj" files for IntelliSense tracking.

Related

Unity3d Issue - Assembly will not be loaded due to errors: X references strong named Y Assembly references: 10.0.0.0 Found in project: 13.0.0.0

I have an issue with a dll im using inside unity3d.
Im trying to use the jose-jwt.dll
link to the library:
https://www.nuget.org/packages/jose-jwt-forunity/
and when I'm importing it into unity3d I get this error:
Assembly 'Assets/jose-jwt.dll' will not be loaded due to errors:
jose-jwt references strong named Newtonsoft.Json Assembly references 10.0.0.0 Found in project: 13.0.0.0.
Assembly Version Validation can be disabled in Player Settings "Assembly Version Validation"
now from my understanding the jose-jwt.dll have a dependency of at least version of 10.0.0.0 of the Newtonsoft.Json, so why this error occurs and how should I fix it?
Unity3d has its own Newtonsoft.Json from what i can tell.
I need it to create a JWT and send it to an api server.
Thanks for the help!

Triying to run VLC for unity plugin demo

This is the repo: https://code.videolan.org/videolan/vlc-unity
I was finally able to build the plugin, but when I try to run the example in unity, a couple of exceptions appear:
Assets\VLC-Unity-Windows\Scripts\UseRenderingPlugin.cs(32,25): error CS1061: 'MediaPlayer' does not contain a definition for 'SetTime' and no accessible extension method 'SetTime' accepting a first argument of type 'MediaPlayer' could be found (are you missing a using directive or an assembly reference?)
Assets\VLC-Unity-Windows\Scripts\UseRenderingPlugin.cs(95,40): error CS1061: 'MediaPlayer' does not contain a definition for 'GetTexture' and no accessible extension method 'GetTexture' accepting a first argument of type 'MediaPlayer' could be found (are you missing a using directive or an assembly reference?)
Plugins: Failed to load 'Assets / VLC-Unity-Windows / Plugins / x86_64 / plugins / VLCUnityPlugin.dll' because one or more of its dependencies could not be loaded.
I am using these versions of dlls, located on unity plugin folder: LibVLCSharp v3.4.3.0 libvlc.dll v3.0.8.0 libvlccore.dll v3.0.8.0
and the last version of the repository.
could you help me?
To make this work, you need:
LibVLCSharp Unity build netstandard2.0 (version 4.0),
Nightly libvlc 4 llvm x64 build
Build of the Unity C++ plugin
It's still a bit rough around the edges, lacks some samples but it will get better with time :-)
Good luck.

Am I doing something wrong with importing Oculus Integration in Unity?

When I go to the Asset Store in Unity and import the Oculus Integration I get 63 error messages.
I have tried re-installing Unity, it didn't work. I can't find anyone else having similar issues.
Error Messages:
Assets\Oculus\VR\Scripts\Util\OVRCursor.cs(22,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Assets\Oculus\VR\Scripts\Util\OVRInputModule.cs(25,35): error CS0246: The type or namespace name 'PointerInputModule' could not be found (are you missing a using directive or an assembly reference?)
Assets\Oculus\VR\Scripts\Util\OVRInputModule.cs(432,40): error CS0246: The type or namespace name 'MouseState' could not be found (are you missing a using directive or an assembly reference?)
There is many more like this, suggesting files are missing.
Unity Version 2019.3.0a3
Ok, this solves this problem, but either there is something wrong with Unity (tested 2019.2.0b4, 2019.1.4f1, and the 2019.3 versions) or Oculus Integration.
Add and a reference to Unity.ugui in Unity like in the picture.
I encountered a couple of compiler error as well, but those could just be commented as it was in sample code.
Make sure you run Unity Hub with administration rights and import Oculus Integration again
All VR components were renamed to XR.
Just double click on the errors and replace the lines of the Using statement with XR
e.g.
OVRTracker.cs
using VR = UnityEngine.VR;
// is changed to
using XR = UnityEngine.XR;
And the error will disappear.
I replaced VR with XR and it worked for everything except one boundary error.

Facing Issue When I build the MixedRealityToolkit-Unity (V2) sample project

I am facing issue when I build the MixedRealityToolkit-Unity(V2) sample project,I faced the following error :
Assets\MixedRealityToolkit.Providers\WindowsMixedReality\WindowsMixedRealityArticulatedHand.cs(418,73): error CS0246: The type or namespace name 'HandJointKind' could not be found (are you missing a using directive or an assembly reference?)
Assets\MixedRealityToolkit.Providers\WindowsMixedReality\WindowsMixedRealityArticulatedHand.cs(111,17): error CS0246: The type or namespace name 'HandMeshObserver' could not be found (are you missing a using directive or an assembly reference?)
Assets\MixedRealityToolkit.Providers\WindowsMixedReality\WindowsMixedRealityArticulatedHand.cs(382,33): error CS0246: The type or namespace name 'HandJointKind' could not be found (are you missing a using directive or an assembly reference?)
Assets\MixedRealityToolkit.Providers\WindowsMixedReality\WindowsMixedRealityArticulatedHand.cs(412,26): error CS0246: The type or namespace name 'JointPose' could not be found (are you missing a using directive or an assembly reference?)
I am running on Windows 10 Insider preview with
OS build : 18362.30
Version : 1903
Also I double checked with build setting
Minimum SDK is 10.0.10240.0
Target SDK version is “Latest installed”
I am using mrtk_development branch for the MixedRealityToolkit-Unity.
Can any one help me or guide me if I am missing any steps here for the set-up.
Thanks.
These errors look like Unity is actually not using the latest installed SDK. Have you tried the following:
Restart your computer (not kidding).
Delete your old Build/UWP folder.
Delete Unity's Library folder (under YourProject/Library).
Re-open Unity, and try to build again.
Finally I am able to build MRTK-V2 into HoloLens :-) Just give it a try by adding Windows SDK 18362+ which is mention on Toolkit home page.
I thought I am running under insider build 18362.30 so I don't need to install this SDK, But seem like it is required anyway.

How do I reference a UWP+NET46 portable library from a .NET 4.6 console application?

I have a portable class library project that targets .NET 4.6 and Universal Windows Platform. This class library contains just one class with the following line of code in its constructor:
Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
Now I create a new .NET 4.6 console application project in the same solution and add a project reference to the portable class library. Calling the method that houses the above line of code results in the following exception at runtime:
Could not load file or assembly 'System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
What am I doing wrong here? There are no compile-time errors or warnings.
Things I have tried: add missing(?) NuGet package manually
It seems that System.IO.FileSystem is a library delivered via NuGet, as part of the Microsoft.NETCore mega-package. Okay, perhaps I need to explicitly add this package to any project that uses my portable class library. I attempt to do so.
Could not install package 'Microsoft.NETCore.Platforms 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
No luck with this approach.
Things I have tried: create a project.json file
While there is no clear info on the web, I read a few tidbits about a new project.json based NuGet harness or build system. Just to experiment, I created the following project.json file in my console application project:
{
"dependencies": {
},
"frameworks": {
"net46": { }
},
"runtimes": {
"win-anycpu": { }
}
}
It works! The runtime error goes away! However, I soon found that this was either not the right solution or not a complete solution. I started writing some code to read configuration section values, which involved making use of the IConfigurationSectionHandler interface, and got the following compile-time error:
error CS0246: The type or namespace name 'IConfigurationSectionHandler' could not be found (are you missing a using directive or an assembly reference?)
This interface is part of the System assembly. I see a reference to this assembly, but it has a yellow exclamation mark icon, and a warning appears in the warnings window:
The referenced component 'System' could not be found.
This is where I ran out of ideas. Am I missing something totally obvious?
I have found the solution. My initial attempt was to install the Microsoft.NETCore package into the console application, resulting in the error shown in my original post.
However, if I install only the narrowly-scoped packages, e.g. System.IO.FileSystem, then I achieve success and the application works correctly. Apparently there is something special about the Microsoft.NETCore "master package" that prevents it from correctly installing into dependent projects.