Log in or register to post comments

Load ARCamera in one scene and use it another

July 17, 2012 - 11:54am #1

Is it possible to load ARCamera in 1 scene (aka the main scene) and then after calling GameObject.DontDestroyOnLoad(ARCamera object) use it in another scene?

I want to have a load screen where the ARCamera is first Instantated then turn the gameObjec off until i go into the scene that I need to use the camera on.

When i try to get the camera back in another scene I this Error on Each update()

I/Unity   ( 7805): NullReferenceException

I/Unity   ( 7805):   at ImageTracker.UpdateTrackablePoses (UnityEngine.Camera arCamera, .TrackableData[] trackableDataAr

ray, Int32 originTrackableID) [0x00000] in <filename unknown>:0

I/Unity   ( 7805):   at QCARManager.UpdateTrackers () [0x00000] in <filename unknown>:0

I/Unity   ( 7805):   at QCARManager.Update (ScreenOrientation counterRotation) [0x00000] in <filename unknown>:0

I/Unity   ( 7805):   at QCARBehaviour.Update () [0x00000] in <filename unknown>:0

I/Unity   ( 7805):

I/Unity   ( 7805): (Filename:  Line: -1)

I/Unity   ( 7805):

 

Is what I am trying to do possible? And if so how can I do this because it takes a while (30sec - 1min) to load all my trackables, and I want the user of my application to be able to use the AR portion with minimal hassal.

 

Thanks

Load ARCamera in one scene and use it another

May 20, 2013 - 7:42pm #17

I realize that this post is fairly old but perhaps this insight will help some people.  I have found after messing with things in Unity and Vuforia that the only way to have the ARCamera travers the scenes that you load you have to keep the ARCamera, ImageTarget, and the BackgroundCamera created at runtime alive when you change scenes.  I do not pretend to know why we need to do this but I do know that without all three Vuforia breaks.  At first I thought I could just not destroy all camera objects at load however the Vuforia cameras are not camera objects but gameobjects that have camera qualities (components whatever) so in the end I needed to check for the 'MainCamera' tag, the 'ImageTarget' tag, and also get the runtime backgroundCamera by checking the name of the objects in the scene.

 

NOTE: my method for keeping state across scenes WILL NOT work effectively for large or intensive scenes, the project I am working on does not require more than 15 objects in the scenen at a time (including cameras) so searching the scene graph wasn't a big deal.

 

Hope this helps

 

-love

Load ARCamera in one scene and use it another

August 3, 2012 - 10:37am #16

The issue that affects Raigex's project, and yours, is that the DataSet dictionary is refreshed for every new scene. So you'll want to load and activate your dataset in the scenes were it is used. We're looking into providing methods for caching datasets across scenes. If you'd like to see this feature, please add a request to the wish list.

Load ARCamera in one scene and use it another

August 3, 2012 - 9:42am #15

giving this a bump...

David,  The code you posted below, disabling and re-enabling the QCARBehaviour works on the Editor, but not for me when deployed to an iOS device.

Can you please advise?

Load ARCamera in one scene and use it another

July 31, 2012 - 11:27am #14

Hi David, raigex,

Wanted to chime in here with my research as well.  I have a Scene called Menu which consists of an ARCamera Prefab, a d-light, and a script attached to the ARCamera for GUI purposes.  My GUI script allows me to asyncronously and additively load scenes into the Menu Scene. Of the additional scenes I additively load, one contains four ImageTrackables, and the other contains two ImageTrackables with 1 Virtual Button each.

In each of the additively loaded scenes, all the gameobjects are a child of a root GameObject called "ROOT" which allows me to easily Destroy() everything except the ARCamera when I no longer need it.

Implementing David's advice about enabling and disabling the ARCamera's QCARBehaviour, I wrote code which works like a charm in the editor, but not at all when deployed to my iOS device.  In the editor, I can additively load scenes and Destroy assets all day. The ARCamera finds and loses the targets as expected.  However, when I deploy to my iOS Device, additively loading ImageTargets does nothing.  The AR Camera is active, but will not recognize any targets.

I'm hoping that this data, while a bit verbose... can help lead to some advice if I'm doing something wrong, or at least provide a test-case to resolve this problem if the error is not mine.

Pardon the formatting, I tried using the BBCode "code" tags but that didn't work well.

using UnityEngine;

using System.Collections;

 

public enum MainMenuState

{

NOLEVELLOADED = 0,

LEVELLOADED

}

 

public class MainMenu : MonoBehaviour {

 

public static MainMenuState MenuState = MainMenuState.NOLEVELLOADED;

 

void OnGUI()

{

if(MenuState == MainMenuState.NOLEVELLOADED)

{

GUI.Box(new Rect(Screen.width * 0.05f, Screen.height * 0.05f, Screen.width * 0.9f, Screen.height * 0.9f),"Main Menu");

 

if(GUI.Button(new Rect( Screen.width * 0.1f, Screen.height * 0.2f, Screen.width * 0.3f, Screen.height * 0.1f),"Audio Trackables"))

{

GetComponent<QCARBehaviour>().enabled = false;

StartCoroutine(loadAudioTrackablesScene());

}

if(GUI.Button(new Rect( Screen.width * 0.1f, Screen.height * 0.4f, Screen.width * 0.3f, Screen.height * 0.1f),"Virtual Buttons"))

{

GetComponent<QCARBehaviour>().enabled = false;

StartCoroutine(loadVirtualButtonsScene());

}

}

else

{

if(GUI.Button(new Rect( Screen.width * 0.9f, Screen.height * 0.9f, Screen.width * 0.1f, Screen.height * 0.1f),"Home"))

{

AudioSource audio = GameObject.Find("ARCamera").GetComponent<AudioSource>();

if(audio)

audio.Stop();

 

Destroy(GameObject.Find("ROOT"));

 

MenuState = MainMenuState.NOLEVELLOADED;

}

}

}

 

IEnumerator loadAudioTrackablesScene()

{

AsyncOperation async = Application.LoadLevelAdditiveAsync("AudioTrackables");

yield return async;

 

MenuState = MainMenuState.LEVELLOADED;

GetComponent<QCARBehaviour>().enabled = true;

}

 

IEnumerator loadVirtualButtonsScene()

{

AsyncOperation async = Application.LoadLevelAdditiveAsync("VirtualButtons");

yield return async;

 

MenuState = MainMenuState.LEVELLOADED;

GetComponent<QCARBehaviour>().enabled = true;

}

}

 
Finally, here is the console log for running on the device. My actions are:  
  • Start up the app
  • Visually verify the camera is active (it is)
  • Press the "Audio Trackables" button
  • Visually Verify the ARCamera's QCARBehaviour is disabled (it is) and that StopQCAR is output in the console (it is)
  • Visually Verify the ARCamera's QCARBehaviour is enabled (it is) and that StartQCAR is output in the console (it is)
  • Verify in the console that the ImageTrackables I am loading addiively are lost by the ARCamera (they are)
  • Aim the device's camera at one of the four ImageTrackables... Nothing happens!
 

-> applicationDidBecomeActive()

2012-07-31 10:56:54.370 ConcordDemo[6590:707] INFO/AR(6590) 2012-07-31 10:56:54: ImageTracker: Successfully created dataset

Successfully created data set.

Creating Image Target with values: 

 ID:           1

 Name:         GangsterSquad

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x758

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           2

 Name:         Chieftains

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x512

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           3

 Name:         Gumby

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512.166x769

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           4

 Name:         Hayes

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x512

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           5

 Name:         Haynes

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x512

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           6

 Name:         Belvedere

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x691

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           7

 Name:         LittleRichard

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x512

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           8

 Name:         McCartney

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x512

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           9

 Name:         Meiko

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x512

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           10

 Name:         Sherlock

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         512x512

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Creating Image Target with values: 

 ID:           11

 Name:         TigersCurse

 Path:         QCAR/ConcordAR.xml

 Storage Type: STORAGE_APPRESOURCE

 Size:         511.8906x724

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Setting Unity version 3.5.2

StartQCAR

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

2012-07-31 10:56:55.141 ConcordDemo[6590:707] DEBUG/AR(6590) UIView has CAEAGLLayer class

2012-07-31 10:56:55.142 ConcordDemo[6590:707] DEBUG/AR(6590) UIView does not respond to selector renderFrameQCAR

2012-07-31 10:56:55.145 ConcordDemo[6590:707] DEBUG/AR(6590) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-31 10:56:55.151 ConcordDemo[6590:707] DEBUG/AR(6590) UIView has CAEAGLLayer class

2012-07-31 10:56:55.152 ConcordDemo[6590:707] DEBUG/AR(6590) UIView does not respond to selector renderFrameQCAR

2012-07-31 10:56:55.154 ConcordDemo[6590:707] DEBUG/AR(6590) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-31 10:56:55.157 ConcordDemo[6590:707] DEBUG/AR(6590) UIView has CAEAGLLayer class

2012-07-31 10:56:55.158 ConcordDemo[6590:707] DEBUG/AR(6590) UIView does not respond to selector renderFrameQCAR

2012-07-31 10:56:55.160 ConcordDemo[6590:707] DEBUG/AR(6590) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-31 10:56:57.204 ConcordDemo[6590:707] INFO/AR(6590) 2012-07-31 10:56:57: Triggering autofocus not supported

2012-07-31 10:56:57.206 ConcordDemo[6590:707] INFO/AR(6590) 2012-07-31 10:56:57: Setting the torch mode not supported

2012-07-31 10:56:57.208 ConcordDemo[6590:707] INFO/AR(6590) 2012-07-31 10:56:57: Setting the focus mode not supported

Absolute number of Trackables: 11

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Absolute number of virtual buttons: 0

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

2012-07-31 10:56:57.219 ConcordDemo[6590:707] DEBUG/AR(6590) UIView has CAEAGLLayer class

2012-07-31 10:56:57.221 ConcordDemo[6590:707] DEBUG/AR(6590) UIView does not respond to selector renderFrameQCAR

2012-07-31 10:56:57.223 ConcordDemo[6590:707] DEBUG/AR(6590) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

-> force accelerometer registration

Setting camera clear flags to depth only

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

StopQCAR

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Trackable Chieftains lost

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Trackable Hayes lost

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Trackable McCartney lost

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

Trackable Meiko lost

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

StartQCAR

 

(Filename: /Applications/buildAgent/work/300357e52574df36/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

 

2012-07-31 10:57:15.387 ConcordDemo[6590:707] DEBUG/AR(6590) UIView has CAEAGLLayer class

2012-07-31 10:57:15.389 ConcordDemo[6590:707] DEBUG/AR(6590) UIView does not respond to selector renderFrameQCAR

2012-07-31 10:57:15.391 ConcordDemo[6590:707] DEBUG/AR(6590) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-31 10:57:15.394 ConcordDemo[6590:707] DEBUG/AR(6590) UIView has CAEAGLLayer class

2012-07-31 10:57:15.396 ConcordDemo[6590:707] DEBUG/AR(6590) UIView does not respond to selector renderFrameQCAR

2012-07-31 10:57:15.397 ConcordDemo[6590:707] DEBUG/AR(6590) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-31 10:57:15.400 ConcordDemo[6590:707] DEBUG/AR(6590) UIView has CAEAGLLayer class

2012-07-31 10:57:15.402 ConcordDemo[6590:707] DEBUG/AR(6590) UIView does not respond to selector renderFrameQCAR

2012-07-31 10:57:15.403 ConcordDemo[6590:707] DEBUG/AR(6590) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-31 10:57:16.196 ConcordDemo[6590:707] INFO/AR(6590) 2012-07-31 10:57:16: Triggering autofocus not supported

2012-07-31 10:57:16.198 ConcordDemo[6590:707] INFO/AR(6590) 2012-07-31 10:57:16: Setting the torch mode not supported

2012-07-31 10:57:16.202 ConcordDemo[6590:707] INFO/AR(6590) 2012-07-31 10:57:16: Setting the focus mode not supported

Setting camera clear flags to depth only

 

 

Load ARCamera in one scene and use it another

July 26, 2012 - 2:12pm #13

I dont deactivate the ARCamera as a game object. I just deactiate the camera component, the qcarbehaviour component, and a "touch manager" component. 

Also i only have 1 ARCamera. I have several regular cameras that I switch between when for displaying diffrent "activities" of my app. Like the main menu, a modelviewer etc. They are all in 1 scene and i use a CameraController script that I have created to switch between them. Aka hideMainMenu();showInstuction();

mainmenu and instruction are just two different layouts to show different information.

 

I will add it to the wishlist as soon as I find it.

Edit:: 

I have found the problem. Inside the update function I put the whole thing in an if Statement. 

if(Application.loadedlevel.compareTo("ARScene") == 0)

{

do normal update stuff

}

Now it renders the video. I am checking if it will render the models.

Load ARCamera in one scene and use it another

July 25, 2012 - 4:04pm #12

Try this without activating and deactivating the ARCamera as a gameobject, simply use the QCARBehaviour. Is there another camera in this scene as well?  And is the ARCamera still tagged as MainCamera?

So how is the latency from loading the dataset with an ARCamera in each scene?

BTW I have researched and inquired on this, and it appears that the basic issue is that the dataset is being repopulated on the scene load to accommodate any trackables placed in the scene. The caching that you'd attempted is something that we're going to investigate. If you have a chance, please add it to the wish list so that we can organize any feedback from the dev community.

 

Load ARCamera in one scene and use it another

July 25, 2012 - 2:46pm #11

Since loading levels additively was the only way to do this. I decided to go for the many scenes/cameras method and just switch between them.

The thing is when i finally get to the portion where Im supposed to get the tracking started It doesnt.

I have a script that disables everything connected with the ARCamera prefab like this

//ALL components that need to be disabled/enabled

QCARBehaviour mBehaviourScript;

TouchAR mARTouchScript;

 

// Use this for initialization

void Start () {

 

mBehaviourScript = GetComponent<QCARBehaviour>();

mARTouchScript = GetComponent<TouchAR>();

 

}

 

public bool enableScripts()

{

gameObject.camera.enabled = true;

mBehaviourScript.enabled = true;

mARTouchScript.enabled = true;

 

return false;

}

 

public bool disableScripts()

{

gameObject.camera.enabled = false;

mBehaviourScript.enabled = false;

mARTouchScript.enabled = false;

 

return false;

}

 

}

 

THe above script cancels my touch script and my behaviour script which are also connected to the same ARCamera prefab.

 

Then when i want to run the portion of the app that does tracking and rendering I cannot, My Logcat says that the QCARBehavior has startedback up (StartQcar pops out in log)

but the background is dark. I dont know if anything is tracked because not even the video is rendering.

Can you help me?

 

EDIT::

I can tell that this is doing some work (most likeyly tracking) because the phone is getting warmer as it always does when Tracking is happening.

Load ARCamera in one scene and use it another

July 23, 2012 - 8:11am #10

Ok Great,

Thanks for all the help so far and any help you can provide and the future on this problem.

Load ARCamera in one scene and use it another

July 23, 2012 - 8:08am #9

That's the problem with loading scenes additively. It's a a one way path. You'd have to remove any objects you'd loaded to restore the original scene(s).

I've got an inquiry in on this question, and will see what advice I can gather.

Load ARCamera in one scene and use it another

July 23, 2012 - 6:08am #8

OK this code I understand, but with LoadAdditive("scene") what happens when i want to go back to a previous scene because there will be several branches. Will i have to use loadadditive on each of them (which would make it similar to having several cameras and menus in 1 scene and switching in between them (which is what i thought of doing in the beginning)) or is there something I am missing. 

Thanks.

Load ARCamera in one scene and use it another

July 22, 2012 - 5:38pm #7

I've gotten one approach to this technique working by loading the levels additively. Basically I added the ARCamera to the first screen, disabled its QCARBehaviour and then loaded the next scene additively and re-enabled the QCARBehaviour. Disabling the QCARBehaviour stops tracking and the video background rendering. Also you don't need to use DontDestroyOnLoad with this approach.

Here is a script that demonstrates what I'm describing..

 

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ARCameraLoadUtility : MonoBehaviour {
   
    QCARBehaviour qcarBehaviour;

    void Awake () {
        //DontDestroyOnLoad (transform.gameObject);
    }
    // Use this for initialization
    void Start () {
        qcarBehaviour = (QCARBehaviour) FindObjectOfType(typeof(QCARBehaviour));
    }
   
    // Update is called once per frame
    void Update () {
   
    }
   
    void OnGUI(){
       
        if( GUILayout.Button( "Disable ARCamera" , GUILayout.Width(200f),GUILayout.Height(100f)) ){
           
            qcarBehaviour.enabled = false;
           
        }
       
        if( GUILayout.Button( "Load Next Scene" , GUILayout.Width(200f),GUILayout.Height(100f)) ){
           
            Application.LoadLevelAdditive("NextScene");

            qcarBehaviour.enabled = true;

        }
    }
}

Load ARCamera in one scene and use it another

July 20, 2012 - 5:58am #6

Yes that is correct. I want to make all the long loading take place at the start of the application which this is, and be able to use the ARCamera instance in once scene in perticular but I dont want it destroyed when I am not looking at it (aka another scene).

Load ARCamera in one scene and use it another

July 19, 2012 - 7:18pm #5

I've narrowed this down to a null reference occurring for the Trackable reference in the DataSet's dictionary. The Trackable's ImageTargetData struct is marshalled from a pointer passed by the native plugin via interop. It looks the reference is being lost when persisting the ARCamera across scenes. This occurs regardless of the state of the ARCamera.

Let me inquire with our devs on this to see what advice they may have. Basically what you're trying to do, is pre-load your datasets and persist these with the ARCamera instance across scenes - is that correct?

 

 

Load ARCamera in one scene and use it another

July 18, 2012 - 7:16am #4

I have kept tracing and even tried something else. I create the Instantate the ARCamera in the first scene and I modify the object function like so

void update()
{

     If(Application.LoadedLevelName.compareTo("ARScene") == 0)

     {

          //Do normal update stuff. not modified

     }

 

And i changed the startQCAR function like so 

void startQcar()

{

     //normal qcar function not changed

     //added

     if(Application.LoadedLevel.compareTo("ARScene") != 0)

     {

          gameObject.camera.enabled = false;
     }

}

 

Also the error is still there because the trackableBehaviour returned by mActiveDataSet.TryGetTrackableById(trackableData.id, out trackableBehaviour) is null which is because the dictionary somehow gets emptied between the scenes, even though my whole ARCamera has the DontDestroyOnLoad() called on it.

Load ARCamera in one scene and use it another

July 17, 2012 - 2:40pm #3

I cannot test in play mode because my whole Unity freezes and I have to endTask it. I am getting closer to finding exactly where I get the Null reference exception error. I is in the second foreach loop of ImageTracker.cs around line 318 (in mine i added a couple debugs to see so it might not be the same for you.

 

EDIT::

I have found what causes the NullReference Exception: 

it is this code

if (trackableBehaviour.enabled)

                {

 

                    trackableBehaviour.OnTrackerUpdate(

                                            trackableData.status);

                }

in the function :

public void UpdateTrackablePoses(Camera arCamera,

                            QCARManager.TrackableData[] trackableDataArray,

                            int originTrackableID)

My debug log shows that trackableBehaviour is null after this function:

 

            DataSetTrackableBehaviour trackableBehaviour;

            if (mActiveDataSet.TryGetTrackableByID(trackableData.id,

                                                   out trackableBehaviour)) 

 

EDIT 2::

I have found that the dictionary is Empty.

Load ARCamera in one scene and use it another

July 17, 2012 - 1:57pm #2

It looks like QCARManager may be losing refence to the ARCamera instance, which is defined when QCARBehaviour is initialized in Start(), here..

        // Initialize the QCARManager
        QCARManager.Instance.WorldCenterMode = mWorldCenterMode;
        QCARManager.Instance.WorldCenter = mWorldCenter;
        QCARManager.Instance.ARCamera = camera;
        QCARManager.Instance.Init();

I'll have to test the method that you're using. When you test these scenes in Play Mode, does the ARCamera retain its settings across scenes?

Log in or register to post comments