public void OnEnable() { MarkerAbstractBehaviour target = (MarkerAbstractBehaviour)base.target; if (QCARUtilities.GetPrefabType(target) != PrefabType.Prefab) { if (!SceneManager.Instance.SceneInitialized) { SceneManager.Instance.InitScene(); } IEditorMarkerBehaviour behaviour2 = target; if (!behaviour2.InitializedInEditor && !EditorApplication.isPlaying) { behaviour2.SetMarkerID(SceneManager.Instance.GetNextFrameMarkerID()); CreateMesh(target); behaviour2.SetNameForTrackable("FrameMarker" + behaviour2.MarkerID); target.name = "FrameMarker" + behaviour2.MarkerID; behaviour2.SetInitializedInEditor(true); EditorUtility.SetDirty(target); SceneManager.Instance.SceneUpdated(); } else if (!EditorApplication.isPlaying) { CheckMesh(target); } behaviour2.SetPreviousScale(target.transform.localScale); } }
// Initializes the Marker when it is drag-dropped into the scene. public void OnEnable() { MarkerBehaviour markerBehaviour = (MarkerBehaviour)target; // We don't want to initialize if this is a prefab. if (QCARUtilities.GetPrefabType(markerBehaviour) == PrefabType.Prefab) { return; } // Initialize scene manager if (!SceneManager.Instance.SceneInitialized) { SceneManager.Instance.InitScene(); } IEditorMarkerBehaviour editorMarkerBehaviour = markerBehaviour; // Only setup marker if it has not been set up previously. if (!editorMarkerBehaviour.InitializedInEditor && !EditorApplication.isPlaying) { editorMarkerBehaviour.SetMarkerID(SceneManager.Instance.GetNextFrameMarkerID()); CreateMesh(markerBehaviour); editorMarkerBehaviour.SetNameForTrackable("FrameMarker" + editorMarkerBehaviour.MarkerID); markerBehaviour.name = "FrameMarker" + editorMarkerBehaviour.MarkerID; editorMarkerBehaviour.SetInitializedInEditor(true); // Inform Unity that the behaviour properties have changed. EditorUtility.SetDirty(markerBehaviour); // Inform the scene manager about the newly added marker (to get validation). SceneManager.Instance.SceneUpdated(); } else if (!EditorApplication.isPlaying) { CheckMesh(markerBehaviour); } // Cache the current scale of the marker: editorMarkerBehaviour.SetPreviousScale(markerBehaviour.transform.localScale); }