Unity3d and vuforia detecting if target appears - unity3d

I am new here so I want to ask my first question.
I am using unity3d and vuforia for augmented reality.
I already set up AR camera on my scene and target image and object and works perfectly.
I am trying to play a sound when my 3d model appears on stage but without any luck.
So far I tried to follow this tutorial: https://www.youtube.com/watch?v=4u177CpPbp8 but in the line public class PlaySoundOnImageTarget : MonoBehaviour, ITrackableEventHandler comes with an error on ITrackableEventHandler.
It's red colored and when I am moving my mouse on this it says "error CS0103: the name ITrackableEventHandler does not exist in the current context".
I tried to write the full code but a lot of lines come with almost the same errors.
Also, I tried this one: [https://developer.vuforia.com/forum/faq/unity-how-can-i-play-audio-when-targets-get-detected]
Any help, please?
I am using unity3d 5.4.2f2.

You will need to include Vuforia before you can use it.
You can do so by placing Using Vuforia; at the top of your screen
Next time you might also want to read through the pages of Vuforia as they already solve this and a lot of other very basic errors you might walk into in the near future.

Related

UnityEditor.ObjectPreview was not disposed properly - Unity 2021.3.9f1

I'm pretty new to Unity, still learning this game engine. I wanted to try making a basic scene with barrels that I model in Blender, I followed this tutorial GAME ASSET BEGINNER TUTORIAL - Exporting from Blender to Unity and everything goes fine until I came across this error.
Console error Image link
UnityEditor.ObjectPreview was not disposed properly. Make sure that base.Cleanup is called if overriding the Cleanup method. If you are implementing this in an Editor or EditorWindow, don't forget to call ObjectPreview.Cleanup in OnDisable.
UnityEditor.ObjectPreview:Finalize ()
I tried to find a solution but I couldn't find anything that could fix this error. On some Reddit thread, I found that a problem might be in mesh Normals, I already recalculate it in my Blender project but the same thing happens.
Although my barrel model looks just fine on the scene, I want to know what this error means.
I'm using Blender 3.2.2 and my Unity project is on Unity version 2021.3.9f1
Barrel model on the scene Image link

Hololens + Unity: GameObjects are invisible

After I build my Unity project and send it to the Hololens, I have the following problem:
The splash screen appear followed by a debugging window on the bottom. In the background is a white net. However, you can't see any game objects. I've tested a lot but haven't found a solution for that. Visual Studio does not display any error messages. What I've looked at roughly:
These are my modules. Im using the 2019.4.22f1 version of Unity and the MRTK Foundation Toolkit 2.7.2.
My build settings
My project settings
I tried to place the objects in the middle of the camera and changed the colors.
MRTK settings I haven't changed anything most of the time
Main camera settings
My scene
When i start the scene i get this error in the console. I dont know if this has anything to do with my problem
i have two possible solutions (no guarantee)##
you could spawn the objects on input directly in front of the
camera, add a debug.log("object in front of you"); so you can find
the issue.
If this doesnt work i would try to test differnet types of materials
like you do with HDRP.
if this does not work either i probably cant help you out now.
It seems like your GameObject is too far to be hidden behind by the mesh. Please make the spatial mesh invisible by setting the Display Option property of Spatial Mesh Observer Setting to None, this item can be found under the Spatial Awareness profile of the MRTK profile.

Why do my 2D objects not collide in Unity despite that the layers are set correctly?

I have a platform that I need to flip the direction of when it collides with an object. The platform as well as its child objects belong to the layer "FlyingOrPlatform". The object that the platform collides with should belong to the "GameControl" layer. But if i set it to that it doesnt collide with it.
If I set the object that the platform collides with to either the "Player" or "Default" layer. Then it works completely as it should. But I wish to use the "GameControl" layer.
I have tried where I save the scene and the project, as well as restarting the editor.
I dont see what should be wrong with my layer setup. Any suggestions?
In my script for reversing the platform direction there is no layer check, it does check the tag but I ensured that the tag is the same when I switch between the layers. I just use Unity's built in OnTriggerEnter2D lifecycle method. Have tested with OnCollisionEnter2D and OnTriggerStay2D as well, same result.
Here is a link to a video demonstrating the issue, as well as a screenshot of my physics2D settings below. In the video I first show how its supposed to work, and then I switch the object the platform collides with to the GameControl layer, after which it doesnt work.
Video of issue: https://www.youtube.com/watch?v=l-eqYI-K-Ug
Physics2D settings:
From what I can tell this appears to be an issue with the Physics2D matrix in Unity that occurs from time to time. A couple of other people have written similar things on other forums.
Among others this reply had a similar issue:
For lack of better, I found a work-around by using the "Ignore Raycast" layer instead of the "GameControl" layer.
I have reported it as a bug to Unity.
EDIT:
Here is the reply I got from Unity.
"Hi,
We successfully reproduced this issue. It will be possible to follow
the progress on a chosen resolution in our public Issue Tracker once
the report has been processed (this might take up to an hour):
https://issuetracker.unity3d.com/product/unity/issues/guid/1325018
We highly appreciate your contribution. If you have further questions,
please feel free to contact us."

Can't add Orbital script - "The script needs to derive from MonoBehaviour!"

I am developing in Unity 3D for the Microsoft HoloLens 1. I am trying to add the Orbital script from the Mixed Reality Tool Kit to a GameObject, but no matter what I do I keep getting this error message:
"Can't add script behaviour ScreenSpaceMousePointer. The script needs to derive from MonoBehaviour!"
I don't understand why I'm getting this message, since I'm trying to add Orbital, not ScreenSpaceMousePointer. Is there any way to get around this?
EDIT: For further context, I am trying to affix an upright plane with a little map on it to the bottom right of the HoloLens display such that it follows the user wherever they turn their head (much like how a minimap looks in video games).
Orbital inherits from Solver which inherits from MonoBehaviour. So you should be adding it to a GameObject. It's unclear why that error message is appearing without more information.
What version of MRTK/Unity are you using?
Can you create a cube and add orbital via "AddComponent" in inspector?
Can you search for the orbital script in your assets window and drag it onto a simple cube in inspector?
Unfortunately I cannot repo your issue. You can also try looking at the SolverExamples unity scene.
Please, show this script.
Head of it must be like this:
class Orbital: MonoBehavior {
And file name must be Orbital.cs
You may create this file and put inside code you need, but rename class and file to avoid duplicate class name.
Do you have errors in your project? This usually happens for a message you got.

Kudan for Unity v1.2.2: Creating Custom Markers

I'm trying to get started with Kudan in Unity using Kudan package v.1.2.2 on Mac OS. I have spent quite long time trying just to test detecting my own marker but I always fail. Here are the steps I did:
Downloaded both Unity package and Kudan ARTool Kit.
Created new Unity Project and deleted default components.
Imported Kudan Package.
Draged and dropped "Kudan Camera" and added my Editor API Key.
In Kudan ARTool kit, I created a new project and imported a simple marker (.png file):
simple marker
Recorded the marker dimensions, which were 300x300.
I then exported the marker to a .KARMarker file.
In Unity, I clicked on "Add KARMarker Asset" and selected my .KARMarker.
Then, I dragged the created .asset file to MarkerTracking component.
Finally, I run the player mode. It runs without problem, but never detects my marker.
Appreciate if anyone can help me on what I missed, or what I wrong steps I did.
** Please note that the application runs perfectly without my custom marker.
Your steps sound correct, the issue that I think is causing you this issue is the marker that you have chosen. It has sharp contrasts which is great but rather lacks interesting feature points to make it a good reliable marker.
I would recommend having a look at Kudan's article about what makes a good marker. After you have chosen something that fits the criteria better, you should find that your sample should work.
Maybe you have markerless tracking by default and don't marker tracking.
And you put good expected id in marker transform driver script of your gameObject that you want to watch?