vuforia unity scene load blank - unity3d

I am having an issue regarding unity scene loading from assetbundle. I have created a scene with vuforia ARCamera and few image targets. I converted that to an assetbundle. Till now is fine but when I'm importing and loading the scene, it is showing a black scene without showing the AR camera but the image target is detecting the marker and showing the result on the black screen. Is there any way to start the AR camera after loading the assetbundle scene?
Thanks in advance.

Is there any way to start the AR camera after loading the assetbundle
scene?
you can wait for a scene to load using SceneManager.sceneLoaded. Then when the scene is completely loaded you can instantiate/activate your AR camera.
// called first
void OnEnable()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
// called second
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//Put the code to enable/instantiate your ARCamera here
}
do mind that this has to be called after you have completely loaded the assetbundle
More info on how the SceneManager works can be found in the SceneManager unity docs

Related

unity scenemanager only reload active scene

public void startscene(string scnm)
{
Debug.Log("DF");
SceneManager.LoadScene(scnm);
Debug.Log("DF");
}
I used this code to go back to the menu scene and come to the game scene from the menu scene. And it workes fine when loading the game scene from the menu scene.
But it only reloads the active scene when I try to go back to the menu scene. What's the problem?
The only explanation is that you are calling the method startscene passing the same scene name.

How to get Vuforia and MRTK MultiScene System works?

I'm working on AR Project with the HoloLens 2. I need to recognize a QRcode to build my Buttons in the real world at the right positions. So what I'm doing I used MRTK 2.2 and I applied the MRTK configuration. I work with the Multi Scene System so that I have MainScene Manager where all children are not destroyable.
The camera is under the MainSceneManger and I attached to it Vuforia Behavior and DefaultIntialization error Handler and the Image target is under other Scene. The camera could not detect the Image which is in the Fact my QRcode, but when I put the ImageTarget under the MainSceneManager where the Main camera is it works fine. How could I get this work when the Image Target and Main camera are not under the Same Scene.
Ps: In the attached picture I Loaded the Haupseite Scene intentionally so that you can see where the ImageTarget placed.

Unity camera got stuck with a particular view in build file after importing objects from blender

I attached a First-Person Camera Control script to Unity's camera for navigating in the scene. Then I imported an object from blender and placed it in the scene. When I clicked the play mode, everything works fine (i.e. navigating in the scene). But when I ran the app after build, I can't navigate and got stuck with a view to which I did not set the Unity's camera.
This is the view to which I got stuck but I did not set the Unity's camera to focus this view.
I found what the problem is. In Blender, there will a default camera present in the scene.
And this camera was pointing to the view below -_-
I imported the object to unity without deleting this camera which caused the trouble. After deleting this camera, my problem was solved.

Unity Video Player

I am failing at playing a simple video under unity free 2017.1.0f3 personal
I am working on a game and I'd like to play an introduction video at the start of the app. Then move onto the login screen whenever the player clicks it.
I have created a video player object, dragged and dropped the video clip (mp4) into the video clip field of the object.
I then attached the object to the camera. In the script attached to the camera I created a public VideoPlayer that I have populated with the video player object.
I then execute :
void Awake ()
{
VideoPlayer.Play();
}
But nothing happens.
Perhaps it should be executed within a separate thread (coroutine)? I tried but did not work either.
Any help please?
Provided you filled the right settings, if it still doesn't play but you get no error, no freeze, no nothing.
Trying restarting Unity.
(I struggled for 45 min trying to figure out why my video wouldn't play anymore until I restarted Unity and it magically reworked)
did you check if the Video can be played back by unity?
put a quad in front of your camera, put a videocomponent on there, check Loop and playonAwake, hit Play and see if it works.
GameObjectWithPlayerComponentAttatched.GetComponent<VideoPlayer>().Play();
should work fine
Did you assign the RenderTexture?
What I do is create a RenderTexture, then assign it to the videoplayer, then add a Raw Image and then give it the RenderTexture in the Texture field.
You should uncheck play onAwake if you want to play it at a certain point, instead of videoplayer.Play, use videoPlayer.
Prepare and prepareCompleted Play the video.
Like this:
private void Start()
{
videoPlayer.prepareCompleted += VideoPlayer_prepareCompleted;
videoPlayer.Prepare();
}
private void VideoPlayer_prepareCompleted(VideoPlayer source)
{
videoPlayer.Play();
}
Video Player has three modes: Render Texture -- and then you need to select a RenderTexture to render to, Material Override -- and then it needs a mesh to write to its material, and Camera -- then you need to assign a camera and select to render to the near or far plane.
To have the camera feature work automatically, you need to instantiate the VideoPlayer script on the camera object itself.
Follow these steps to play a video using unity's VideoPlayer component:
Create a plane, under 3d Objects.
Add a VideoPlayer component to that plane.
Set render mode as Material Override.
Drag the mesh renderer component of the plane to the videoplayer's renderer field.
Select a video clip to play and enable play on awake.
Press play in the editor window.

Locate Metaio camera on a fixed position as gui texture + Display one object from the scene through that Metaio camera

1) I am a beginner to using Metaio in Unity, so my question is that is it possible to include two cameras on my scene: one is the main for 3D environment, and another camera (metaio camera) to display objects from Unity on the real world that must be fixed on the top wright corner as UI plane of my game. Something like in the picture below:
2) Also, how to display on the metaio camera view on the scene instead of displaying all scene objects as shown in the image below, although I only attached one cube object under metaio tracker:
Any help or answers gratefully received.
Thanks.
you have to attach an script to that plain and add the code bellow to that script:
void Start() {
WebCamTexture webcamTexture = new WebCamTexture();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
if you working for android you have to add camera permission to you manifest.
i think you need to work on it, because it doesnt work simply and you have to play with camera positions and to work very well.
this link shows you camera options that you have in unity:
http://docs.unity3d.com/ScriptReference/WebCamTexture.html