/// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            SpriteTexture spriteTexture = InspectedObject as SpriteTexture;

            if (spriteTexture == null)
            {
                return(InspectableState.NotModified);
            }

            InspectableState state = genericDrawer.Refresh();

            if (state != InspectableState.NotModified)
            {
                // The inspector will by default just assign a resource reference without loading it, make sure we load it
                // so it can be previewed
                if (spriteTexture.Texture != null && !spriteTexture.Texture.IsLoaded)
                {
                    Resources.Load <Texture>(spriteTexture.Texture.UUID);
                }

                // Make sure GUI redraws as the sprite texture properties were updated
                previewTexture.SetTexture(spriteTexture);
            }

            return(state);
        }
示例#2
0
        private void OnEditorUpdate()
        {
            InspectableState viewOptionsState = guiViewSettings.Refresh();

            if (viewOptionsState != InspectableState.NotModified)
            {
                SceneWindow sceneWindow = SceneWindow.GetWindow <SceneWindow>();
                if (sceneWindow != null)
                {
                    sceneWindow.Camera.ViewSettings = viewSettings;
                }

                ProjectSettings.SetObject(SceneCamera.ViewSettingsKey, viewSettings);
            }

            InspectableState moveOptionsState = guiMovementSettings.Refresh();

            if (moveOptionsState != InspectableState.NotModified)
            {
                SceneWindow sceneWindow = SceneWindow.GetWindow <SceneWindow>();
                if (sceneWindow != null)
                {
                    sceneWindow.Camera.MoveSettings = moveSettings;
                }

                ProjectSettings.SetObject(SceneCamera.MoveSettingsKey, moveSettings);
            }

            InspectableState renderOptionsState = guiRenderSettings.Refresh();

            if (renderOptionsState != InspectableState.NotModified)
            {
                SceneWindow sceneWindow = SceneWindow.GetWindow <SceneWindow>();
                if (sceneWindow != null)
                {
                    sceneWindow.Camera.RenderSettings = renderSettings;
                }

                ProjectSettings.SetObject(SceneCamera.RenderSettingsKey, renderSettings);
            }
        }
 /// <inheritdoc/>
 protected internal override InspectableState Refresh()
 {
     return(drawer.Refresh());
 }