Esempio n. 1
0
 void OnDestroy()
 {
     foreach (var handle in m_AllHandles)
     {
         UnityObjectUtils.Destroy(handle.GetComponent <Renderer>().sharedMaterial);
     }
 }
Esempio n. 2
0
 public void OnDestroy()
 {
     foreach (var kvp in m_MaterialDictionary)
     {
         UnityObjectUtils.Destroy(kvp.Key);
     }
 }
Esempio n. 3
0
 public void OnDestroy()
 {
     if (widget)
     {
         UnityObjectUtils.Destroy(widget.gameObject);
     }
 }
Esempio n. 4
0
 void OnDestroy()
 {
     UnityObjectUtils.Destroy(m_InsetMaterial);
     UnityObjectUtils.Destroy(m_IconMaterial);
     UnityObjectUtils.Destroy(m_FrameMaterial);
     UnityObjectUtils.Destroy(m_MaskMaterial);
 }
        static void ReParentChildren(Transform currentParent, Transform newParent)
        {
            var children = new List <Transform>();

            foreach (Transform child in currentParent)
            {
                var landmarkController = child.gameObject.GetComponent <LandmarkController>();
                var landmarkHasContent = landmarkController != null && child.childCount > 0;
                if (landmarkController == null || landmarkHasContent)
                {
                    children.Add(child);
                }
                else
                {
                    UnityObject.DestroyImmediate(child.gameObject);
                }
            }

            foreach (var child in children)
            {
                child.parent = newParent;
            }

            UnityObjectUtils.Destroy(currentParent.gameObject);
        }
Esempio n. 6
0
 void OnDestroy()
 {
     UnityObjectUtils.Destroy(m_TextMaterial);
     UnityObjectUtils.Destroy(m_ExpandArrowMaterial);
     UnityObjectUtils.Destroy(m_LockIconMaterial);
     UnityObjectUtils.Destroy(m_UnlockIconMaterial);
 }
Esempio n. 7
0
        void OnDestroy()
        {
            if (m_Preferences != null && m_Preferences.meshGroupingMode)
            {
                CombineGroups();
            }

            CleanUpNames();

            if (rayOrigin)
            {
                this.RemoveRayVisibilitySettings(rayOrigin, this);
            }

            if (m_BrushSizeUI)
            {
                this.DisconnectInterfaces(m_BrushSizeUI, rayOrigin);
                UnityObjectUtils.Destroy(m_BrushSizeUI.gameObject);
            }

            if (m_ToolMenu)
            {
                UnityObjectUtils.Destroy(m_ToolMenu);
            }

            if (m_AnnotationPointer)
            {
                UnityObjectUtils.Destroy(m_AnnotationPointer.gameObject);
            }

            this.ClearFeedbackRequests(this);
        }
Esempio n. 8
0
 void OnDisable()
 {
     Camera.onPostRender -= RenderMiniWorld;
     // Unset target texture so we don't destroy it and crash the editor
     m_MiniCamera.targetTexture = null;
     UnityObjectUtils.Destroy(m_MiniCamera.gameObject);
 }
Esempio n. 9
0
 public void Shutdown()
 {
     if (m_SpatialHintUI)
     {
         UnityObjectUtils.Destroy(m_SpatialHintUI.gameObject);
     }
 }
Esempio n. 10
0
        public void Setup()
        {
            manager = EditingContextManager.instance;
            go      = new GameObject("context test object");
            var transformTool       = go.AddComponent <TransformTool>();
            var createPrimitiveTool = go.AddComponent <CreatePrimitiveTool>();

            context      = ScriptableObject.CreateInstance <EditorXRContext>();
            context.name = "Some Other Context";
            context.m_DefaultToolStack = new List <MonoScript>();
            context.m_DefaultToolStack.Add(MonoScript.FromMonoBehaviour(transformTool));
            context.m_DefaultToolStack.Add(MonoScript.FromMonoBehaviour(createPrimitiveTool));
            UnityObjectUtils.Destroy(go);

            context2      = ScriptableObject.CreateInstance <EditorXRContext>();
            context2.name = "Yet Another Context";
            context2.m_DefaultToolStack = context.m_DefaultToolStack;

            settings = ScriptableObject.CreateInstance <EditingContextManagerSettings>();
            settings.defaultContextName = "Custom Default Context";
            newSettings = ScriptableObject.CreateInstance <EditingContextManagerSettings>();
            newSettings.defaultContextName = "New Custom Default Context";

            // Save once so that we can detect a change--without this, SaveProjectSettings_UpdatesProjectSettingsFile will fail on CloudBuild
            EditingContextManager.SaveProjectSettings(settings);
        }
Esempio n. 11
0
        protected override void CopyComponent(int id)
        {
            m_SerializedObject.Update();

            var property     = m_ComponentProperty.GetArrayElementAtIndex(id);
            var componentObj = property.objectReferenceValue;

            if (s_ClipboardGameObject == null)
            {
                s_ClipboardGameObject = GameObject.Find(k_ClipboardGameObjectName)
                                        ?? EditorUtility.CreateGameObjectWithHideFlags(k_ClipboardGameObjectName, HideFlags.HideAndDontSave);
                s_ClipboardGameObject.SetActive(false);
            }

            if (s_ClipboardContent != null)
            {
                UnityObjectUtils.Destroy(s_ClipboardContent);
                s_ClipboardContent = null;
            }

            var component = componentObj as Component;

            Assert.IsNotNull(component);

            var compType = component.GetType();

            s_ClipboardContent = s_ClipboardGameObject.GetComponent(compType);

            if (s_ClipboardContent == null)
            {
                s_ClipboardContent = s_ClipboardGameObject.AddComponent(compType);
            }

            EditorUtility.CopySerializedIfDifferent(componentObj, s_ClipboardContent);
        }
        internal override void CancelCreate()
        {
            if (EditMode)
            {
                if (m_CreatedObject == null) // Possible if child was already destroyed by closing the create window
                {
                    UnityObjectUtils.Destroy(m_BackupObject);
                }
                else
                {
                    m_BackupObject.transform.parent = m_CreatedObject.transform.parent;
                    m_BackupObject.transform.SetSiblingIndex(m_CreatedObject.transform.GetSiblingIndex());
                    m_BackupObject.name = m_BackupObject.name.Remove(m_BackupObject.name.LastIndexOf("(BACKUP)"));
                    foreach (var potentialCondition in m_PotentialConditions)
                    {
                        potentialCondition.gameObjectOwner = m_BackupObject;
                    }

                    UnityObjectUtils.Destroy(m_CreatedObject);
                    m_CreatedObject            = m_BackupObject;
                    m_CreatedObject.hideFlags &= ~HideFlags.HideInHierarchy;
                }
            }
            else
            {
                if (m_PlacedChildContent != null)
                {
                    UnityObjectUtils.Destroy(m_PlacedChildContent);
                }

                base.CancelCreate();
            }
        }
Esempio n. 13
0
 public void ClearSubmenus()
 {
     foreach (var submenu in m_Submenus)
     {
         UnityObjectUtils.Destroy(submenu);
     }
 }
Esempio n. 14
0
        void IFunctionalityProvider.UnloadProvider()
        {
            m_ARPointCloudManager.pointCloudsChanged -= ARPointCloudManagerOnPointCloudsChanged;
            if (m_NewARPointCloudManager)
            {
                UnityObjectUtils.Destroy(m_NewARPointCloudManager);
            }

            ARFoundationSessionProvider.TearDownARSession();

            if (m_Identifiers.IsCreated)
            {
                m_Identifiers.Dispose();
            }

            if (m_Positions.IsCreated)
            {
                m_Positions.Dispose();
            }

            if (m_ConfidenceValues.IsCreated)
            {
                m_ConfidenceValues.Dispose();
            }
        }
Esempio n. 15
0
 void TearDownImageEffectsProfile()
 {
     if (m_ImageEffectsVolume != null)
     {
         UnityObjectUtils.Destroy(m_ImageEffectsVolume);
     }
 }
Esempio n. 16
0
 public void CleanupAfterEach()
 {
     foreach (var o in m_ToCleanupAfterEach)
     {
         UnityObjectUtils.Destroy(o);
     }
 }
Esempio n. 17
0
 void OnDestroy()
 {
     if (m_CubeRenderer)
     {
         UnityObjectUtils.Destroy(m_CubeRenderer.sharedMaterial);
     }
 }
Esempio n. 18
0
 void OnDestroy()
 {
     if (m_MainMenuUI)
     {
         UnityObjectUtils.Destroy(m_MainMenuUI.gameObject);
     }
 }
Esempio n. 19
0
 public void Shutdown()
 {
     if (m_Container)
     {
         UnityObjectUtils.Destroy(m_Container.gameObject);
     }
 }
        void CleanupVisualsForDestroyedEntities()
        {
            k_EntitiesToRemove.Clear();

            // Check if any entity no longer exists, then destroy and remove their visuals
            foreach (var kvp in m_EntityVisuals)
            {
                var entity = kvp.Key;
                if (entity != null)
                {
                    continue;
                }

                var entityVisual = kvp.Value;
                if (entityVisual != null)
                {
                    UnityObjectUtils.Destroy(entityVisual.gameObject);
                }

                k_EntitiesToRemove.Add(entity);
            }

            foreach (var entity in k_EntitiesToRemove)
            {
                m_EntityVisuals.Remove(entity);
            }
        }
Esempio n. 21
0
 void OnValidate()
 {
     // Validate that the assigned components implement the interfaces that are required
     m_Source   = UnityObjectUtils.ConvertUnityObjectToType <ICalculateLandmarks>(m_Source) as Component;
     m_Output   = UnityObjectUtils.ConvertUnityObjectToType <ILandmarkOutput>(m_Output) as Component;
     m_Settings = UnityObjectUtils.ConvertUnityObjectToType <ILandmarkSettings>(m_Settings) as Component;
 }
 void OnDestroy()
 {
     if (m_Mesh != null)
     {
         UnityObjectUtils.Destroy(m_Mesh);
     }
 }
Esempio n. 23
0
        public void Shutdown()
        {
            m_CameraInitialized     = false;
            m_OriginalNearClipPlane = 0;
            m_OriginalFarClipPlane  = 0;
            hmdReady = false;

            foreach (var playerObject in m_VRPlayerObjects)
            {
                UnityObjectUtils.Destroy(playerObject);
            }

            m_VRPlayerObjects.Clear();

            var cameraRig = CameraUtils.GetCameraRig();

            if (cameraRig)
            {
                cameraRig.transform.parent = null;
            }

            if (customPreviewCamera != null && customPreviewCamera as MonoBehaviour != null)
            {
                UnityObjectUtils.Destroy(((MonoBehaviour)customPreviewCamera).gameObject);
            }
        }
Esempio n. 24
0
        void StopPreview()
        {
            s_HasRunSimulation = true;
            s_VisitedCount     = int.MaxValue;

            // Need to dispose of mini sim view this also stops usage of sim scene
            UnityObjectUtils.Destroy(m_MiniSimulationView);

            RenderSettings.skybox = m_OriginalSkybox;
            m_CurrentlySimulating = false;
            EditorUtils.ToggleClassIcons(m_IconEnabledOriginalStates);
            QuerySimulationModule.simulationDone -= SaveScreenTask;
            if (RenderSettings.skybox == null)
            {
                RenderSettings.skybox = m_OriginalSkybox;
            }

            var dataVisualsModule = ModuleLoaderCore.instance.GetModule <DataVisualsModule>();

            dataVisualsModule.DisableSimulationDataVisuals = m_CachedDataVisualsModuleEnabled;

            Repaint();

            // Reopen starting scene environment
            var environmentManager = ModuleLoaderCore.instance.GetModule <MARSEnvironmentManager>();

            if (environmentManager != null)
            {
                environmentManager.SetSyntheticEnvironment(m_CachedSceneIndex);
                environmentManager.TryRefreshEnvironmentAndRestartSimulation();
            }
        }
Esempio n. 25
0
        IEnumerator AnimateHideAndDestroy()
        {
            this.StopCoroutine(ref m_PositionCoroutine);
            this.StopCoroutine(ref m_HighlightCoroutine);
            this.StopCoroutine(ref m_ActivatorMoveCoroutine);
            this.StopCoroutine(ref m_HoverCheckCoroutine);
            this.StopCoroutine(ref m_SecondaryButtonVisibilityCoroutine);

            this.HideTooltip(this);
            const int kDurationScalar = 3;
            var       duration        = 0f;
            var       currentScale    = transform.localScale;
            var       targetScale     = Vector3.zero;

            while (duration < 1)
            {
                var durationShaped = Mathf.Pow(MathUtilsExt.SmoothInOutLerpFloat(duration += Time.unscaledDeltaTime * kDurationScalar), 4);
                transform.localScale = Vector3.Lerp(currentScale, targetScale, durationShaped);
                yield return(null);
            }

            transform.localScale  = targetScale;
            m_VisibilityCoroutine = null;
            UnityObjectUtils.Destroy(gameObject, 0.1f);
        }
 void OnDestroy()
 {
     foreach (var material in m_ClonedMaterials)
     {
         UnityObjectUtils.Destroy(material);
     }
 }
Esempio n. 27
0
        IEnumerator AnimateVisibility(bool fadeIn)
        {
            var currentAlpha             = fadeIn ? 0f : m_CanvasGroup.alpha;
            var targetAlpha              = fadeIn ? 1f : 0f;
            var alphaTransitionAmount    = 0f;
            var textTransform            = m_Text.transform;
            var textCurrentLocalPosition = textTransform.localPosition;

            textCurrentLocalPosition = fadeIn ? new Vector3(m_TextOriginalLocalPosition.x, m_TextOriginalLocalPosition.y, m_FadeInZOffset) : textCurrentLocalPosition;
            var textTargetLocalPosition      = m_TextOriginalLocalPosition;
            var positionTransitionAmount     = 0f;
            var transitionSubtractMultiplier = 1f / m_TransitionDuration;

            while (alphaTransitionAmount < 1f)
            {
                var alphaSmoothTransition    = MathUtilsExt.SmoothInOutLerpFloat(alphaTransitionAmount);
                var positionSmoothTransition = MathUtilsExt.SmoothInOutLerpFloat(positionTransitionAmount);
                m_CanvasGroup.alpha         = Mathf.Lerp(currentAlpha, targetAlpha, alphaSmoothTransition);
                textTransform.localPosition = Vector3.Lerp(textCurrentLocalPosition, textTargetLocalPosition, positionSmoothTransition);
                alphaTransitionAmount      += Time.deltaTime * transitionSubtractMultiplier;
                positionTransitionAmount   += alphaTransitionAmount * 1.35f;
                yield return(null);
            }

            textTransform.localPosition = textTargetLocalPosition;
            m_CanvasGroup.alpha         = targetAlpha;
            m_VisibilityCoroutine       = null;

            if (!fadeIn)
            {
                UnityObjectUtils.Destroy(gameObject); // TODO: pool
            }
        }
Esempio n. 28
0
        public void SetupInternal(Transform parentTransform, Action selectedAction, String displayedText = null, string toolTipText = null)
        {
            if (selectedAction == null)
            {
                UnityObjectUtils.Destroy(gameObject);
                return;
            }

            this.selectedAction          = selectedAction;
            m_RectTransform              = (RectTransform)transform;
            m_OriginalSize               = m_RectTransform.sizeDelta;
            m_ExpandedTooltipDisplaySize = new Vector2(m_RectTransform.sizeDelta.x, m_ExpandedTooltipHeight);

            m_Icon.gameObject.SetActive(false);
            m_Text.gameObject.SetActive(true);
            m_Text.text = displayedText;

            transform.SetParent(parentTransform);
            transform.localRotation = Quaternion.identity;
            transform.localPosition = Vector3.zero;
            transform.localScale    = Vector3.one;

            if (Mathf.Approximately(m_TransitionDuration, 0f))
            {
                m_TransitionDuration = 0.001f;
            }

            // Tooltip text related
            m_TooltipVisualsCanvasGroup.alpha = 0;
            m_TooltipText.text = toolTipText;
        }
 void OnValidate()
 {
     // Validate that the assigned components implement the interfaces that are required
     for (var i = 0; i < m_Manipulators.Length; i++)
     {
         m_Manipulators[i] = UnityObjectUtils.ConvertUnityObjectToType <IManipulator>(m_Manipulators[i]) as Object;
     }
 }
Esempio n. 30
0
        public static void DestroyDefaultProxyObjects()
        {
            foreach (var gameObject in k_ToDestroy)
            {
                UnityObjectUtils.Destroy(gameObject);
            }

            k_ToDestroy.Clear();
        }