// Check for duplicate Trackables in the scene.
    private void CheckForDuplicates(IEditorTrackableBehaviour[] trackables)
    {
        //Before we serialize we check for duplicates and provide a warning.
        for (int i = 0; i < trackables.Length; ++i)
        {
            string tNameA = trackables[i].TrackableName;

            // Ignore default names...
            if (tNameA == QCARUtilities.GlobalVars.DEFAULT_TRACKABLE_NAME)
            {
                continue;
            }

            for (int j = i + 1; j < trackables.Length; ++j)
            {
                string tNameB = trackables[j].TrackableName;

                // Ignore default names...
                if (tNameB == QCARUtilities.GlobalVars.DEFAULT_TRACKABLE_NAME)
                {
                    continue;
                }

                // We need to handle data set Trackables differently than markers.
                if (((trackables[i] is DataSetTrackableBehaviour) &&
                     (trackables[j] is DataSetTrackableBehaviour)))
                {
                    IEditorDataSetTrackableBehaviour castedTrackableA = (DataSetTrackableBehaviour)trackables[i];
                    IEditorDataSetTrackableBehaviour castedTrackableB = (DataSetTrackableBehaviour)trackables[j];

                    string tDataA = castedTrackableA.DataSetName;
                    string tDataB = castedTrackableB.DataSetName;

                    // Ignore Data Set Trackables that don't belong to the same data set.
                    if (tDataA.IndexOf(tDataB) != 0)
                    {
                        continue;
                    }
                }
                else if (!((trackables[i] is MarkerBehaviour) &&
                           (trackables[j] is MarkerBehaviour)))
                {
                    // Ignore trackables that are of different type.
                    // Note: Multi Targets and Image Targets still need to have
                    //       different names.
                    continue;
                }

                if (tNameA == tNameB)
                {
                    Debug.LogWarning("Duplicate Trackables detected: \"" +
                                     tNameA +
                                     "\". Only one of the Trackables and its respective Augmentation " +
                                     "will be selected for use at runtime - " +
                                     "that selection is indeterminate here.");
                }
            }
        }
    }
Exemple #2
0
    private ConfigData CreateDataSetFromTrackables(TrackableBehaviour[] trackables)
    {
        if (trackables == null)
        {
            return(null);
        }
        ConfigData data = new ConfigData();

        foreach (TrackableBehaviour behaviour in trackables)
        {
            if (behaviour is DataSetTrackableBehaviour)
            {
                IEditorDataSetTrackableBehaviour behaviour2 = (DataSetTrackableBehaviour)behaviour;
                string dataSetName   = behaviour2.DataSetName;
                string trackableName = behaviour2.TrackableName;
                if (((dataSetName == "--- EMPTY ---") || (dataSetName == "")) || ((trackableName == "--- EMPTY ---") || (trackableName == "")))
                {
                    UnityEngine.Debug.LogWarning("Ignoring default Trackable for export");
                }
                else if (behaviour2 is ImageTargetAbstractBehaviour)
                {
                    ImageTargetAbstractBehaviour behaviour3 = (ImageTargetAbstractBehaviour)behaviour2;
                    IEditorImageTargetBehaviour  behaviour4 = behaviour3;
                    ConfigData.ImageTargetData   item       = new ConfigData.ImageTargetData {
                        size = behaviour4.GetSize()
                    };
                    VirtualButtonAbstractBehaviour[] componentsInChildren = behaviour3.GetComponentsInChildren <VirtualButtonAbstractBehaviour>();
                    item.virtualButtons = new List <ConfigData.VirtualButtonData>(componentsInChildren.Length);
                    foreach (VirtualButtonAbstractBehaviour behaviour5 in componentsInChildren)
                    {
                        Vector2 vector;
                        Vector2 vector2;
                        if (behaviour5.CalculateButtonArea(out vector, out vector2))
                        {
                            ConfigData.VirtualButtonData  data3      = new ConfigData.VirtualButtonData();
                            IEditorVirtualButtonBehaviour behaviour6 = behaviour5;
                            data3.name        = behaviour6.VirtualButtonName;
                            data3.enabled     = behaviour6.enabled;
                            data3.rectangle   = new Vector4(vector.x, vector.y, vector2.x, vector2.y);
                            data3.sensitivity = behaviour6.SensitivitySetting;
                            item.virtualButtons.Add(data3);
                        }
                    }
                    data.SetImageTarget(item, behaviour4.TrackableName);
                }
                else if (behaviour2 is MultiTargetAbstractBehaviour)
                {
                    UnityEngine.Debug.Log("Multi Targets not exported.");
                }
                else if (behaviour2 is CylinderTargetAbstractBehaviour)
                {
                    UnityEngine.Debug.Log("Cylinder Targets not exported.");
                }
            }
        }
        return(data);
    }
Exemple #3
0
    private void CheckForDuplicates(IEditorTrackableBehaviour[] trackables)
    {
        for (int i = 0; i < trackables.Length; i++)
        {
            string trackableName = trackables[i].TrackableName;
            if (trackableName != "--- EMPTY ---")
            {
                for (int j = i + 1; j < trackables.Length; j++)
                {
                    string str2 = trackables[j].TrackableName;
                    if (str2 == "--- EMPTY ---")
                    {
                        continue;
                    }
                    if ((trackables[i] is DataSetTrackableBehaviour) && (trackables[j] is DataSetTrackableBehaviour))
                    {
                        IEditorDataSetTrackableBehaviour behaviour  = (DataSetTrackableBehaviour)trackables[i];
                        IEditorDataSetTrackableBehaviour behaviour2 = (DataSetTrackableBehaviour)trackables[j];
                        string dataSetName = behaviour.DataSetName;
                        string str4        = behaviour2.DataSetName;
                        if (dataSetName.IndexOf(str4) == 0)
                        {
                            goto Label_009A;
                        }
                        continue;
                    }
                    if (!(trackables[i] is MarkerAbstractBehaviour) || !(trackables[j] is MarkerAbstractBehaviour))
                    {
                        continue;
                    }
Label_009A:
                    if (trackableName == str2)
                    {
                        UnityEngine.Debug.LogWarning("Duplicate Trackables detected: \"" + trackableName + "\". Only one of the Trackables and its respective Augmentation will be selected for use at runtime - that selection is indeterminate here.");
                    }
                }
            }
        }
    }
Exemple #4
0
    /// <summary>
    /// Finds DataSetTrackableBehaviours for this dataset and associates them with the Trackables in the DataSet.
    /// VirtualButtonBehaviours created in the scene are associated with the VirtualButtons in the DataSet or created there.
    ///
    /// If there is a Trackable in the DataSet where no TrackableBehaviour exists yet, this Behaviour is created, together with its VirtualButtons.
    /// </summary>
    public void AssociateTrackableBehavioursForDataSet(DataSet dataSet)
    {
        // Step: Add all TrackableBehaviours that belong to this data set and
        // are already instantiated in the scene to the dictionary.
        DataSetTrackableBehaviour[] trackableBehaviours = (DataSetTrackableBehaviour[])
                                                          Object.FindObjectsOfType(typeof(DataSetTrackableBehaviour));

        // Initialize all Image Targets
        foreach (DataSetTrackableBehaviour trackableBehaviour in trackableBehaviours)
        {
            IEditorDataSetTrackableBehaviour editorTrackableBehaviour = trackableBehaviour;
            if (editorTrackableBehaviour.TrackableName == null)
            {
                Debug.LogError("Found Trackable without name.");
                continue;
            }

            // check if the TrackableBehaviour references this DataSet
            if (editorTrackableBehaviour.DataSetPath.Equals(dataSet.Path))
            {
                bool matchFound = false;

                // find the trackable to be associated with this TrackableBehaviour:
                foreach (Trackable trackable in dataSet.GetTrackables())
                {
                    if (trackable.Name.Equals(editorTrackableBehaviour.TrackableName))
                    {
                        if (trackableBehaviour is ImageTargetBehaviour &&
                            trackable is ImageTarget)
                        {
                            IEditorImageTargetBehaviour editorImageTargetBehaviour = (ImageTargetBehaviour)trackableBehaviour;

                            matchFound = true;

                            editorImageTargetBehaviour.InitializeImageTarget((ImageTarget)trackable);
                            mTrackableBehaviours[trackable.ID] = trackableBehaviour;
                            Debug.Log("Found Trackable named " + trackableBehaviour.Trackable.Name +
                                      " with id " + trackableBehaviour.Trackable.ID);
                        }
                        else if (trackableBehaviour is MultiTargetBehaviour &&
                                 trackable is MultiTarget)
                        {
                            matchFound = true;

                            IEditorMultiTargetBehaviour editorMultiTargetBehaviour = (MultiTargetBehaviour)trackableBehaviour;
                            editorMultiTargetBehaviour.InitializeMultiTarget((MultiTarget)trackable);
                            mTrackableBehaviours[trackable.ID] = trackableBehaviour;
                            Debug.Log("Found Trackable named " + trackableBehaviour.Trackable.Name +
                                      " with id " + trackableBehaviour.Trackable.ID);
                        }
                    }
                }

                if (!matchFound)
                {
                    Debug.LogError("Could not associate DataSetTrackableBehaviour '" + editorTrackableBehaviour.TrackableName +
                                   "' - no matching Trackable found in DataSet!");
                }
            }
        }


        // Step 2: Add all VirtualButtonBehaviours that belong to this data set
        // and are already instantiated in the scene to the dictionary.
        VirtualButtonBehaviour[] vbBehaviours = (VirtualButtonBehaviour[])
                                                Object.FindObjectsOfType(typeof(VirtualButtonBehaviour));
        AssociateVirtualButtonBehaviours(vbBehaviours, dataSet);

        // Step 3: Create TrackableBehaviours that are not existing in the scene.
        CreateMissingDataSetTrackableBehaviours(dataSet);
    }
Exemple #5
0
    IEnumerator Starter()
    {
        if (GameObject.Find("ObjLoaderHolder") == null)
        {
            var g = GameObject.Instantiate(Resources.Load("ObjLoaderHolder"));
            g.name = "ObjLoaderHolder";
        }

        ////////////////////////////////////////////////////////////////////////////////
        // Load data set
        ////////////////////////////////////////////////////////////////////////////////
        int count = 0;

        while (!QCARRuntimeUtilities.IsQCAREnabled())
        {
            yield return(new WaitForSeconds(0.5f));

            count++;
            if (count > 10)
            {
                Debug.LogError("Timeout exception of waying QCARRuntimeUtilities.IsQCAREnabled");
                yield break;
            }
        }
        Debug.Log("DataSetLoadBehaviour: IsQCAREnabled == true");
        var path = Configuration.ConfigMaganer.Instance.Application.XmlPath;

        if (!path.StartsWith("/"))
        {
            path = System.IO.Path.Combine(Application.persistentDataPath, path);
        }

        if (QCARRuntimeUtilities.IsPlayMode())
        {
            // initialize QCAR
            QCARUnity.CheckInitializationError();
        }

        if (TrackerManager.Instance.GetTracker <ImageTracker>() == null)
        {
            TrackerManager.Instance.InitTracker <ImageTracker>();
        }

        if (!DataSet.Exists(path, DataSet.StorageType.STORAGE_ABSOLUTE))
        {
            Debug.LogError("Data set " + path + " does not exist.");
            Application.Quit();
        }

        ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker <ImageTracker>();
        DataSet      dataSet      = imageTracker.CreateDataSet();

        if (!dataSet.Load(path, DataSet.StorageType.STORAGE_ABSOLUTE))
        {
            Debug.LogError("Failed to load data set " + path + ".");
            Application.Quit();
        }
        imageTracker.ActivateDataSet(dataSet);
        Debug.Log("Dataset activated: " + path);
        ////////////////////////////////////////////////////////////////////////////////



        while (!QCARManager.Instance.Initialized)
        {
            yield return(new WaitForEndOfFrame());
        }
        ////////////////////////////////////////////////////////////////////////////////
        QCARRenderer.Instance.DrawVideoBackground = Configuration.ConfigMaganer.Instance.Application.Debug;
        ////////////////////////////////////////////////////////////////////////////////

        if (CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_INFINITY))
        {
            Debug.Log("Camera focus mode setted to FOCUS_MODE_INFINITY");
        }
        else
        {
            Debug.Log("Camera can't focus to FOCUS_MODE_INFINITY");
        }

        var markersLister = Camera.main.GetComponent <MarkersLister>();

        DataSetTrackableBehaviour[] trackableBehaviours = (DataSetTrackableBehaviour[])GameObject.FindObjectsOfType(typeof(DataSetTrackableBehaviour));
        var selectionObjectOriginal = (GameObject)Resources.Load("SelectionObject");

        foreach (DataSetTrackableBehaviour trackableBehaviour in trackableBehaviours)
        {
            IEditorDataSetTrackableBehaviour editorTrackableBehaviour = trackableBehaviour;

            if (editorTrackableBehaviour.gameObject.transform.childCount == 0)
            {
                editorTrackableBehaviour.gameObject.name = "Marker[" + editorTrackableBehaviour.TrackableName + "]";
                editorTrackableBehaviour.gameObject.AddComponent <TurnOffBehaviour>();

                var markerName     = editorTrackableBehaviour.TrackableName;
                var trackableEvent = editorTrackableBehaviour.gameObject.AddComponent <TrackableEventHandler>();

                if (Configuration.ConfigMaganer.Instance.Application.Debug)
                {
                    var obj = (GameObject)GameObject.Instantiate(selectionObjectOriginal);
                    obj.transform.parent        = editorTrackableBehaviour.gameObject.transform;
                    obj.transform.localPosition = Vector3.zero;
                    obj.transform.localScale    = Vector3.one;
                }

                markersLister.AddMarker(markerName, trackableEvent);
            }
        }
    }
    // This method creates a single data set from the trackables provided.
    // The method ignores the data set property in TrackableBehaviour and
    // adds all Trackables to a single file.
    // Default Trackables are not added to the data set.
    private ConfigData CreateDataSetFromTrackables(TrackableBehaviour[] trackables)
    {
        // Sanity check.
        if (trackables == null)
        {
            return(null);
        }

        ConfigData sceneData = new ConfigData();

        foreach (TrackableBehaviour tb in trackables)
        {
            // Ignore non-data set trackables.
            if (!(tb is DataSetTrackableBehaviour))
            {
                continue;
            }

            IEditorDataSetTrackableBehaviour trackable = (DataSetTrackableBehaviour)tb;

            string dataSetName   = trackable.DataSetName;
            string trackableName = trackable.TrackableName;

            // We ignore default Trackables or undefined Trackables.
            if (dataSetName == QCARUtilities.GlobalVars.DEFAULT_DATA_SET_NAME ||
                dataSetName == "" ||
                trackableName == QCARUtilities.GlobalVars.DEFAULT_TRACKABLE_NAME ||
                trackableName == "")
            {
                Debug.LogWarning("Ignoring default Trackable for export");
                continue;
            }

            if (trackable.GetType() == typeof(ImageTargetBehaviour))
            {
                ImageTargetBehaviour        it       = (ImageTargetBehaviour)trackable;
                IEditorImageTargetBehaviour editorIt = it;

                ConfigData.ImageTargetData itConfig = new ConfigData.ImageTargetData();

                itConfig.size = editorIt.GetSize();

                // Process Virtual Button list.
                VirtualButtonBehaviour[] vbs =
                    it.GetComponentsInChildren <VirtualButtonBehaviour>();
                itConfig.virtualButtons = new List <ConfigData.VirtualButtonData>(vbs.Length);
                foreach (VirtualButtonBehaviour vb in vbs)
                {
                    Vector2 leftTop;
                    Vector2 rightBottom;
                    if (!vb.CalculateButtonArea(out leftTop,
                                                out rightBottom))
                    {
                        // Invalid Button
                        continue;
                    }

                    ConfigData.VirtualButtonData vbConfig =
                        new ConfigData.VirtualButtonData();

                    IEditorVirtualButtonBehaviour editorVB = vb;
                    vbConfig.name      = editorVB.VirtualButtonName;
                    vbConfig.enabled   = editorVB.enabled;
                    vbConfig.rectangle = new Vector4(leftTop.x,
                                                     leftTop.y,
                                                     rightBottom.x,
                                                     rightBottom.y);
                    vbConfig.sensitivity = editorVB.SensitivitySetting;

                    itConfig.virtualButtons.Add(vbConfig);
                }

                sceneData.SetImageTarget(itConfig, editorIt.TrackableName);
            }
            else if (trackable.GetType() == typeof(MultiTargetBehaviour))
            {
                Debug.Log("Multi Targets not exported.");
            }
        }

        return(sceneData);
    }
    /// <summary>
    /// Finds DataSetTrackableBehaviours for this dataset and associates them with the Trackables in the DataSet.
    /// VirtualButtonBehaviours created in the scene are associated with the VirtualButtons in the DataSet or created there.
    ///
    /// If there is a Trackable in the DataSet where no TrackableBehaviour exists yet, this Behaviour is created, together with its VirtualButtons.
    /// </summary>
    public void AssociateTrackableBehavioursForDataSet(DataSet dataSet)
    {
        // Step: Add all TrackableBehaviours that belong to this data set and
        // are already instantiated in the scene to the dictionary.
        DataSetTrackableBehaviour[] trackableBehaviours = (DataSetTrackableBehaviour[])
                                                          Object.FindObjectsOfType(typeof(DataSetTrackableBehaviour));

        // Initialize all Image Targets
        foreach (DataSetTrackableBehaviour trackableBehaviour in trackableBehaviours)
        {
            // trackable has been destroyed and shouldn't be associated
            if (mBehavioursMarkedForDeletion.Contains(trackableBehaviour))
            {
                continue;
            }

            IEditorDataSetTrackableBehaviour editorTrackableBehaviour = trackableBehaviour;
            if (editorTrackableBehaviour.TrackableName == null)
            {
                Debug.LogError("Found Trackable without name.");
                continue;
            }

            // check if the TrackableBehaviour references this DataSet
            if (editorTrackableBehaviour.DataSetPath.Equals(dataSet.Path))
            {
                bool matchFound = false;

                // find the trackable to be associated with this TrackableBehaviour:
                foreach (Trackable trackable in dataSet.GetTrackables())
                {
                    if (trackable.Name.Equals(editorTrackableBehaviour.TrackableName))
                    {
                        if (mTrackableBehaviours.ContainsKey(trackable.ID))
                        {
                            // don't replace existing behaviour if it has been created manually
                            if (!mAutomaticallyCreatedBehaviours.Contains(trackable.ID) && !mBehavioursMarkedForDeletion.Contains(mTrackableBehaviours[trackable.ID]))
                            {
                                matchFound = true;
                                continue;
                            }

                            // destroy automatically created behaviour - will be replaced by new one
                            Object.Destroy(mTrackableBehaviours[trackable.ID].gameObject);
                            mTrackableBehaviours.Remove(trackable.ID);
                            mAutomaticallyCreatedBehaviours.Remove(trackable.ID);
                        }

                        if (trackableBehaviour is ImageTargetBehaviour &&
                            trackable is ImageTarget)
                        {
                            IEditorImageTargetBehaviour editorImageTargetBehaviour = (ImageTargetBehaviour)trackableBehaviour;

                            matchFound = true;

                            editorImageTargetBehaviour.InitializeImageTarget((ImageTarget)trackable);
                            mTrackableBehaviours[trackable.ID] = trackableBehaviour;
                            Debug.Log("Found Trackable named " + trackableBehaviour.Trackable.Name +
                                      " with id " + trackableBehaviour.Trackable.ID);
                        }
                        else if (trackableBehaviour is MultiTargetBehaviour &&
                                 trackable is MultiTarget)
                        {
                            matchFound = true;

                            IEditorMultiTargetBehaviour editorMultiTargetBehaviour = (MultiTargetBehaviour)trackableBehaviour;
                            editorMultiTargetBehaviour.InitializeMultiTarget((MultiTarget)trackable);
                            mTrackableBehaviours[trackable.ID] = trackableBehaviour;
                            Debug.Log("Found Trackable named " + trackableBehaviour.Trackable.Name +
                                      " with id " + trackableBehaviour.Trackable.ID);
                        }
                        else if (trackableBehaviour is CylinderTargetBehaviour &&
                                 trackable is CylinderTarget)
                        {
                            matchFound = true;

                            IEditorCylinderTargetBehaviour editorCylinderTargetBehaviour = (CylinderTargetBehaviour)trackableBehaviour;
                            editorCylinderTargetBehaviour.InitializeCylinderTarget((CylinderTarget)trackable);
                            mTrackableBehaviours[trackable.ID] = trackableBehaviour;
                            Debug.Log("Found Trackable named " + trackableBehaviour.Trackable.Name +
                                      " with id " + trackableBehaviour.Trackable.ID);
                        }
                    }
                }

                if (!matchFound)
                {
                    Debug.LogError("Could not associate DataSetTrackableBehaviour '" + editorTrackableBehaviour.TrackableName +
                                   "' - no matching Trackable found in DataSet!");
                }
            }
        }

        // Step 2: Add all VirtualButtonBehaviours that belong to this data set
        // and are already instantiated in the scene to the dictionary.
        VirtualButtonBehaviour[] vbBehaviours = (VirtualButtonBehaviour[])
                                                Object.FindObjectsOfType(typeof(VirtualButtonBehaviour));
        AssociateVirtualButtonBehaviours(vbBehaviours, dataSet);

        // Step 3: Create TrackableBehaviours that are not existing in the scene.
        CreateMissingDataSetTrackableBehaviours(dataSet);
    }
Exemple #8
0
 internal void AssociateTrackableBehavioursForDataSet(DataSet dataSet)
 {
     DataSetTrackableBehaviour[] behaviourArray = (DataSetTrackableBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(DataSetTrackableBehaviour));
     foreach (DataSetTrackableBehaviour behaviour in behaviourArray)
     {
         if (!this.mBehavioursMarkedForDeletion.Contains(behaviour))
         {
             IEditorDataSetTrackableBehaviour behaviour2 = behaviour;
             if (behaviour2.TrackableName == null)
             {
                 Debug.LogError("Found Trackable without name.");
             }
             else if (behaviour2.DataSetPath.Equals(dataSet.Path))
             {
                 bool flag = false;
                 foreach (Trackable trackable in dataSet.GetTrackables())
                 {
                     if (trackable.Name.Equals(behaviour2.TrackableName))
                     {
                         if (this.mTrackableBehaviours.ContainsKey(trackable.ID))
                         {
                             if (!this.mAutomaticallyCreatedBehaviours.Contains(trackable.ID) && !this.mBehavioursMarkedForDeletion.Contains(this.mTrackableBehaviours[trackable.ID]))
                             {
                                 flag = true;
                                 continue;
                             }
                             UnityEngine.Object.Destroy(this.mTrackableBehaviours[trackable.ID].gameObject);
                             this.mTrackableBehaviours.Remove(trackable.ID);
                             this.mAutomaticallyCreatedBehaviours.Remove(trackable.ID);
                         }
                         if ((behaviour is ImageTargetAbstractBehaviour) && (trackable is ImageTarget))
                         {
                             IEditorImageTargetBehaviour behaviour3 = (ImageTargetAbstractBehaviour)behaviour;
                             flag = true;
                             behaviour3.InitializeImageTarget((ImageTarget)trackable);
                             this.mTrackableBehaviours[trackable.ID] = behaviour;
                             Debug.Log(string.Concat(new object[] { "Found Trackable named ", behaviour.Trackable.Name, " with id ", behaviour.Trackable.ID }));
                         }
                         else if ((behaviour is MultiTargetAbstractBehaviour) && (trackable is MultiTarget))
                         {
                             flag = true;
                             IEditorMultiTargetBehaviour behaviour4 = (MultiTargetAbstractBehaviour)behaviour;
                             behaviour4.InitializeMultiTarget((MultiTarget)trackable);
                             this.mTrackableBehaviours[trackable.ID] = behaviour;
                             Debug.Log(string.Concat(new object[] { "Found Trackable named ", behaviour.Trackable.Name, " with id ", behaviour.Trackable.ID }));
                         }
                         else if ((behaviour is CylinderTargetAbstractBehaviour) && (trackable is CylinderTarget))
                         {
                             flag = true;
                             IEditorCylinderTargetBehaviour behaviour5 = (CylinderTargetAbstractBehaviour)behaviour;
                             behaviour5.InitializeCylinderTarget((CylinderTarget)trackable);
                             this.mTrackableBehaviours[trackable.ID] = behaviour;
                             Debug.Log(string.Concat(new object[] { "Found Trackable named ", behaviour.Trackable.Name, " with id ", behaviour.Trackable.ID }));
                         }
                         else if ((behaviour is IEditorRigidBodyTargetBehaviour) && (trackable is InternalRigidBodyTarget))
                         {
                             flag = true;
                             ((IEditorRigidBodyTargetBehaviour)behaviour).InitializeRigidBodyTarget((InternalRigidBodyTarget)trackable);
                             this.mTrackableBehaviours[trackable.ID] = behaviour;
                             Debug.Log(string.Concat(new object[] { "Found Trackable named ", behaviour.Trackable.Name, " with id ", behaviour.Trackable.ID }));
                         }
                     }
                 }
                 if (!flag)
                 {
                     Debug.LogError("Could not associate DataSetTrackableBehaviour '" + behaviour2.TrackableName + "' - no matching Trackable found in DataSet!");
                 }
             }
         }
     }
     VirtualButtonAbstractBehaviour[] vbBehaviours = (VirtualButtonAbstractBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(VirtualButtonAbstractBehaviour));
     this.AssociateVirtualButtonBehaviours(vbBehaviours, dataSet);
     this.CreateMissingDataSetTrackableBehaviours(dataSet);
 }