I've been working in Unity the last month or so. I've gotten a few iterations of a basic AR application worked up but I've updated Unity and now my code is throwing all sorts of errors.
Last week my app was working fine when building to my Pixel phone. Now that I've updated to Unity 2018.3.9, Vuforia 8.1 is now missing the name space mentioned in the title. Does anyone have any information on this?
The app will play correctly if I restart Unity up until I try to build the application to the phone. Once I build and it fails I can't replay the application due to compiler errors.
I've typed in different namespaces in the Vuforia Script and have checked my script. Mine is the same script I've used in previous versions with zero issues. I have Vuforia in the namespace but the issue appears to be coming form the Vuforia inherent script instead.
Here's the section of the Vuforia Code that appears to have the most bugs:
\\\\
namespace Vuforia.UnityCompiled
{
public class RuntimeOpenSourceInitializer
{
static IUnityCompiledFacade sFacade;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void OnRuntimeMethodLoad()
{
InitializeFacade();
}
static void InitializeFacade()
{
if (sFacade != null) return;
sFacade = new OpenSourceUnityCompiledFacade();
UnityCompiledFacade.Instance = sFacade;
}
class OpenSourceUnityCompiledFacade : IUnityCompiledFacade
{
readonly IUnityRenderPipeline mUnityRenderPipeline = new UnityRenderPipeline();
public IUnityRenderPipeline UnityRenderPipeline
{
get { return mUnityRenderPipeline; }
}
}
class UnityRenderPipeline : IUnityRenderPipeline
{
public event Action<Camera[]> BeginFrameRendering;
public event Action<Camera> BeginCameraRendering;
public UnityRenderPipeline()
\\\\\
I'm not versed enough in C# to know the fine tunings of QC'ing the code other than the immediate lack of ";" in a lot of these lines.
What the app should be doing is building correctly to my phone. Once there it's an application that reads a sketch I drew, and shows a model or several renderings of the space based on the image target and virtual buttons placed in Unity.
Hello
Not sure how you created your app, but these errors look similar to ones you'd get if there was a mismatch between the Engine SDK version and the Vuforia samples. As the SDK evolves and APIs are created/changes, so do the samples to be compatible with them. Here's how you can check the versions of both (assuming you used Vuforia samples resources):
- SDK version: Unity Editor->Window->Vuforia Configuration.
- Samples version: Unity Editor->Project window: Assets/Vuforia/version.
also, you can delete the old version of Vuforia and re-import from the Package Manager in Unity.
Thanks,
Related
The type or namespace name 'SmartTerrain' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'PositionalDeviceTracker' could not be found (are you missing a using directive or an assembly reference?)
These errors weren't in version 9 but in version 10 they are affecting project flow please help me
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Vuforia;
public class ARManager : MonoBehaviour
{
public PlaneFinderBehaviour finder;
SmartTerrain smartTerrain;
PositionalDeviceTracker positionalDeviceTracker;
...........
tl;dr: These types don't exist anymore since they are not needed anymore.
I would start at Vuforia - Migration Guide for Vuforia Engine Unity Projects.
In general for any software library it is not unlikely that things and the API change between major versions - indeed such a breaking change is one of the main reasons to release a new major version at all!
This page documents the changes between Vuforia Engine version 9.8 and version 10 as the API has fundamentally changed. Use this overview to learn about the native changes and for migrating your existing projects to the new API.
So read up what to use instead or what changed in the API => what you have to change in your code to adopt - or stick to the version 9 if it worked for you and you don't need the newest features ;)
In your specific cases
Ground Plane
Some more advanced Ground Plane APIs have changed. Apps that were using not just the game objects above, but additional runtime scripting APIs might have to be adapted.
The Smart Terrain Tracker has been removed. It no longer needs to be managed manually. Consequently, checking for Ground Plane support at runtime has changed.
Vuforia Engine 9.8:
SmartTerrain smartTerrain = TrackerManager.Instance.GetTracker<SmartTerrain>();
if (smartTerrain == null)
Debug.Log("SmartTerrain returned null. GroundPlane not supported on this device.");
Vuforia Engine 10.0:
if (VuforiaBehaviour.Instance.World.AnchorsSupported == false)
Debug.Log("GroundPlane not supported on this device.");
and
Device Tracking
Access to device tracking has been simplified and is now available
centrally through VuforiaBehaviour.Instance.DevicePoseBehaviour.
Resetting Device Tracking
Vuforia Engine 9.8:
var deviceTracker = TrackerManager.Instance.GetTracker<PositionalDeviceTracker>();
deviceTracker.Reset();
Vuforia Engine 10.0:
VuforiaBehaviour.Instance.DevicePoseBehaviour.Reset();
Registering to updates to the device tracking status
Vuforia Engine 9.8:
private void Start()
{
DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);
}
void OnDevicePoseStatusChanged(Vuforia.TrackableBehaviour.Status status, Vuforia.TrackableBehaviour.StatusInfo statusInfo)
{
Debug.Log("OnDevicePoseStatusChanged(" + status + ", " + statusInfo + ")");
…
}
Vuforia Engine 10.0:
private void Start()
{
VuforiaBehaviour.Instance.DevicePoseBehaviour.OnTargetStatusChanged += OnDevicePoseStatusChanged;
}
void OnDevicePoseStatusChanged(ObserverBehaviour behaviour, TargetStatus targetStatus)
{
Debug.Log("OnDevicePoseStatusChanged(" + targetStatus.Status + ", " + targetStatus.StatusInfo + ")");
}
Enabling and disabling Device Tracking
Vuforia Engine 9.8:
public void ToggleDeviceTracking(bool enableDeviceTracking)
{
var posDeviceTracker = TrackerManager.Instance.InitTracker<PositionalDeviceTracker>();
if (enableDeviceTracking)
posDeviceTracker.Start();
else
posDeviceTracker.Stop();
}
Vuforia Engine 10.0:
public void ToggleDeviceTracking(bool enableDeviceTracking)
{
VuforiaBehaviour.Instance.DevicePoseBehaviour.enabled = enableDeviceTracking;
}
I've tried most of the online resources including this link too to integrate my unity project into swift 4 native project but unfortunately not helped until now. When I do Linked fix I got into below c++ file error:
No member named 'GetHostByAddr40' in 'il2cpp::icalls::System::System::Net::Dns'; did you mean 'GetHostByAddr'?
Btw I am actually doing a augmented reality project which having some native iOS designs too. Since so I've done those parts using swift 4 with Xcode 9.2. The native part contains the project's start and the end part. In between that, there is augmented reality part which is done by using unity 2018.2.0f2 personal and vofuria 7.2.23.
In the end, now I have an iOS native project and unity project. I wanted to integrate the unity part into iOS native!
After a long search, I get ride the error.
After fixing with this described solutions, I've ended up with Bulk_Mono.Security_1.cpp file not found. So I've started to search for it. Then I've got identified the problem. The problem is with 4.0 Scripting runtime version of .Net. I made the project with 4.0 because of the use of LitJson requires min 4.0. The 4.0 is not generating the Bulk_Mono.Security_1.cpp file for iOS. Then I've removed the LitJson from the project and downgraded the project runtime version to 3.x Equivalent and it started to work fine with the changes on the following 2 files.
Note that just integrate the generated objective-c project as like a framework usually then make following changes and run.
made the change following on DisplayManager.mm generated file which is located in classes/unity. The auto-generated not contains the last line of return deviceUnknown;. So we have to write manually.
elif PLATFORM_TVOS
if (!strncmp(model, "AppleTV5,", 9))
return deviceAppleTV1Gen;
else if (!strncmp(model, "AppleTV6,", 9))
return deviceAppleTV2Gen;
else
return deviceUnknown;
endif
return deviceUnknown
Do the following change on SplashScreen.mm which is located in generated project's classes/ui. Change the bool hasStoryboard = [[NSBundle mainBundle] pathForResource: #"LaunchScreen" ofType: #"storyboardc"] != nullptr; to bool hasStoryboard = [[NSBundle mainBundle] pathForResource: #"LaunchScreen_1" ofType: #"storyboardc"] != nullptr;. The complete method below.
void ShowSplashScreen(UIWindow* window)
{
bool hasStoryboard = [[NSBundle mainBundle] pathForResource: #"LaunchScreen_1" ofType: #"storyboardc"] != nullptr;
if (hasStoryboard)
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:
#"LaunchScreen" bundle: [NSBundle mainBundle]];
_controller = [storyboard
instantiateViewControllerWithIdentifier: #"unitySplashStoryboard"];
}
else
_controller = [[SplashScreenController alloc] init];
[_controller create: window];
[window makeKeyAndVisible];
}
That's all about how I integrated.
I have recently got into c# with XNA and am just making the transition to MonoGame since I've read that XNA is no longer supported. With that said I have come across a problem in MonoGame that I didn't have with XNA when attempting to make a Load() method for a Sprite class in my program. The way I used to do it in XNA is as follows:
public void Load(ContentManager content)
{
content.Load<Texture2D>(AssetName);
}
Now the problem I have with MonoGame is that I cannot seem to reference ContentManager in my Sprite class. The class has all the 'using Microsoft.Xna.Framework' that my Game1 class has, and nothing in my code is static so I don't understand why I cannot reference ContentManager, since it is not recognised when I try and put it in the Load(). Is there a different way to do this in MonoGame, or am I not referencing it properly?
Hm, I don't see the issue right away, but I'll try to help:
You have probably tried right-click/resolve already, but it's worth saying it anyways.
Reminder that Loading content in Monogame is different than using XNA. You've to use the build-in pipeline tool and transfer the content over there, don't forget to build it everytime when uploading a new texture.
There has been no changes to the Content.RootDirectory?
Just making some heads-up to be sure you've done that. and hopefully this will help you out as well.
Assuming you've referenced the MonoGame.Framework.dll or NuGet package there's nothing special about the code. It should look something like this:
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace YourGameProject
{
public class Sprite
{
public string AssetName { get; set; }
public void Load(ContentManager content)
{
content.Load<Texture2D>(AssetName);
}
}
}
I just wrote that code in my own project and it compiles. If it's not working for you there must be something else wrong.
I have just started using Parse.com On Unity 5.0.0fb, and after getting my application to work with Parse on Unity Editor I decided to try it on my Mobile to find nothing works. I have checked the APK and Parse is inside it but when I try anything it does not work.
I have tested this with a Test APK with nothing but parse and the test script attached to a button and it also does not work.
using UnityEngine;
using System.Collections;
using Parse;
public class ScriptTest : MonoBehaviour {
public UnityEngine.UI.Text Mytext;
string mytext;
// Use this for initialization
public void MySpecial () {
ParseObject testObject = new ParseObject("TestObject");
testObject["foo"] = "bar";
testObject.SaveAsync();
mytext = "Saved";
Mytext.text = mytext;
Debug.Log (mytext);
}
// Update is called once per frame
void Update () {
}
}
It will not do anything the button will click it will say saved on my text but when I check parse TestObject nothing will be there. Is there something im missing in my build?
I have made sure stripping is also disabled.
This works 100% in editor just not in Android I have no idea or way to test iOS.
I have the exact same problem, using Unity 5.1 and Parse Unity SDK 1.5.1. It works perfectly in the editor but not on Android.
Here's my code :
ParseObject _localPlayer = new ParseObject();
Task query = _localPlayer.SaveAsync();
while (!query.IsCompleted)
yield return null;
if (!query.IsFaulted && !query.IsCanceled)
{
Debug.Log ("Player successfully created!");
}
else
{
Debug.Log("Failed to create player...");
}
The task generated with the SaveAsync() request doesn't seem to end at all (isCompleted is never true) so it becomes an infinite loop, and the actual cloud operation is not performed (no trace on the Parse dashboard). There doesn't seem to be any exception thrown and the device log doesn't show anything.
I'm really stuck at this point and haven't be able to find any solution anywhere on the web so far. :(
Using Parse SDK 1.3.2 "fixes" the issue.
-> https://parse.com/downloads/windows/Parse/1.3.2
Looks like a big fat regression. ;)
Going back to Parse Unity SDK 1.3.2 worked for me.
LogOutAsync() had to be replaced with LogOut(), but that was the only change I had to make in my code.
The solution to this problem is to reimport project settings from their blank project. It will fix any build problems you have.
The bug report, for those who would like to be kept informed:
https://developers.facebook.com/bugs/1623483557935932/
I have created a fairly simple Activity in Mono for Android project:
[Activity(Label = "AndroidApplication1", MainLauncher = true, Icon = "#drawable/icon")]
public class Activity1 : Activity
{
private string value = "intitial";
[Export]
public string GetString()
{
return value;
}
[Export]
public void SetString(string newValue)
{
value = newValue;
}
}
The activity should only serve as a proof-of-concept, hence its simplicity. Now, I'd like to be able to call the method GetString() from the "normal", Java-based Android application.
In Xamarin's docs, I've read about Java to Managed interop, which seems to be exactly what I'm looking for. If I understand it correctly, when Mono for Android app compiles, it generates Java classes that are referred to as Android Callable Wrappers (ACW). I should be then able to call methods on these ACWs from Java-based Android application.
The question is, how exactly do I reference compiled Mono for Android application (the apk file) from the Java-based Android app?
This is where I'm now stuck and was unable to find any concrete examples. There are similar questions here on SO (this one and this one) and some blogposts, but they just boil down to "use ACWs". But how exactly? Maybe I am missing something obvious here, being no Android guy.
What I've tried is to dynamically load the dex file that I yanked from my Mono for Android apk. I've simply put it on the storage card and then tried to use DexClassLoader from Java-based Android app to load it (I've followed this blog post). The ACW class was found, but when I tried to create its instance, I got the following error:
No implementation found for native Lmno/android/Runtime;.register (Ljava/lang/String;Ljava/lang/Class;Ljava/lang/String;)
I suppose that I have to somehow include Mono for Android runtime to the Java-based app, but I have no idea how.
EDIT:
This is the code I am trying to load the dex with:
DexClassLoader cl = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(),
optimizedDexOutputPath.getAbsolutePath(),
null,
getClassLoader());
try {
Class<?> classActivity1 = cl.loadClass("androidapplication1.Activity1");
// the following line throws the exception
Object a = classActivity1.newInstance();
Method getStringMethod = classActivity1.getMethod("GetString");
Object result = getStringMethod.invoke(angel);
result = null;
} catch (Exception e) {
e.printStackTrace();
}
EDIT2:
I am now reading here that it should be possible to directly start activities written in Mono for Android from Java. It is still not clear to me how to reference the Mono for Android from Java and Googling yields no relevant hits. Really stumped now.
If I'm understanding correctly what you're trying to do, this isn't really possible. As the error message you got implies, an Activity within a Mono for Android application relies on the Mono runtime in order to function properly. The callable wrapper isn't useful on its own in this case, since it's just a thin Java wrapper class that calls into the Mono runtime. You can actually see the generated callable wrappers yourself if you look in the obj/Debug/android/src folder after you build your project. For example:
package androidapplication9;
public class Activity1
extends android.app.Activity
implements
mono.android.IGCUserPeer
{
static final String __md_methods;
static {
__md_methods =
"n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" +
"";
mono.android.Runtime.register ("AndroidApplication9.Activity1, AndroidApplication9, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", Activity1.class, __md_methods);
}
public Activity1 ()
{
super ();
if (getClass () == Activity1.class)
mono.android.TypeManager.Activate ("AndroidApplication9.Activity1, AndroidApplication9, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { });
}
public void onCreate (android.os.Bundle p0)
{
n_onCreate (p0);
}
private native void n_onCreate (android.os.Bundle p0);
java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
That said, due to the way Android works, you could have a Java application start an activity that is defined in a Mono for Android application in the same way you'd start an external Java activity. This relies on both applications being installed, of course, but would result in the Mono for Android application and Mono runtime actually starting up to run that activity.
Edit
Updating to answer the questions you posed in your comment. The ExportAttribute basically just gives you some more control in how the ACW gets generated, allowing you to specify that a particular method or field should be present in the ACW and what name it should have. This can be useful when you want to use things like an android:onClick attribute in a layout, for example, where by default the ACW wouldn't contain the method you want to reference.
You can't get much use out of an ACW outside of the context of a Mono for Android application since the Mono runtime wouldn't be present. Code written in C# is executed on top of the Mono runtime, and not translated into Java behind the scenes during compilation or anything like that. At runtime there are then two runtimes going side by side, Dalvik (Android's runtime) and Mono, and the callable wrappers are there to allow the two to communicate back and forth. Because of that, even a Mono for Android class library would still depend on the Mono runtime, so you cannot use it independently of that runtime.
This diagram shows what the architecture looks like, and how the runtimes relate to each other:
Hope this helps clear things up!