예제 #1
0
        /// <summary>
        /// Get all <see cref="INotchSimulatorTarget"> and update them.
        /// </summary>
        internal static void UpdateSimulatorTargets()
        {
            var simulatedRectRelative    = NotchSimulatorUtility.enableSimulation ? NotchSimulatorUtility.CalculateSimulatorSafeAreaRelative() : new Rect(0, 0, 1, 1);
            var simulatedCutoutsRelative = NotchSimulatorUtility.enableSimulation ? NotchSimulatorUtility.CalculateSimulatorCutoutsRelative() : new Rect[0];

            //This value could be used by the component statically.
            NotchSolutionUtility.SimulatedSafeAreaRelative = simulatedRectRelative;
#if UNITY_2019_2_OR_NEWER
            NotchSolutionUtility.SimulatedCutoutsRelative = simulatedCutoutsRelative;
#endif

            var normalSceneSimTargets = GameObject.FindObjectsOfType <UIBehaviour>().OfType <INotchSimulatorTarget>();
            foreach (var nst in normalSceneSimTargets)
            {
                nst.SimulatorUpdate(simulatedRectRelative, simulatedCutoutsRelative);
            }

            //Now find one in the prefab mode scene as well
            PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
            if (prefabStage != null)
            {
                var prefabSceneSimTargets = prefabStage.stageHandle.FindComponentsOfType <UIBehaviour>().OfType <INotchSimulatorTarget>();
                foreach (var nst in prefabSceneSimTargets)
                {
                    nst.SimulatorUpdate(simulatedRectRelative, simulatedCutoutsRelative);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Get all <see cref="INotchSimulatorTarget"> and update them.
        /// </summary>
        internal static void UpdateSimulatorTargets()
        {
            var enableSimulation = Settings.Instance.EnableSimulation;
            var selectedDevice   = SimulationDatabase.ByIndex(Settings.Instance.ActiveConfiguration.DeviceIndex);

            var simulatedRectRelative = enableSimulation && selectedDevice != null?NotchSimulatorUtility.CalculateSimulatorSafeAreaRelative(selectedDevice) : NotchSolutionUtility.defaultSafeArea;

            var simulatedCutoutsRelative = enableSimulation && selectedDevice != null?NotchSimulatorUtility.CalculateSimulatorCutoutsRelative(selectedDevice) : NotchSolutionUtility.defaultCutouts;

            var normalSceneSimTargets = GameObject.FindObjectsOfType <MonoBehaviour>().OfType <INotchSimulatorTarget>();

            foreach (var nst in normalSceneSimTargets)
            {
                nst.SimulatorUpdate(simulatedRectRelative, simulatedCutoutsRelative);
            }

            //Now find one in the prefab mode scene as well
            PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();

            if (prefabStage != null)
            {
                var prefabSceneSimTargets = prefabStage.stageHandle.FindComponentsOfType <MonoBehaviour>().OfType <INotchSimulatorTarget>();
                foreach (var nst in prefabSceneSimTargets)
                {
                    nst.SimulatorUpdate(simulatedRectRelative, simulatedCutoutsRelative);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// It is currently active only when Notch Simulator tab is present.
        /// </summary>
        void OnGUI()
        {
            win = this;
            //Sometimes even with flag I can see it in hierarchy until I move a mouse over it??
            EditorApplication.RepaintHierarchyWindow();

            bool enableSimulation = NotchSimulatorUtility.enableSimulation;

            EditorGUI.BeginChangeCheck();

            string shortcut = ShortcutManager.instance.GetShortcutBinding(NotchSolutionShortcuts.toggleSimulationShortcut).ToString();

            if (string.IsNullOrEmpty(shortcut))
            {
                shortcut = "None";
            }
            NotchSimulatorUtility.enableSimulation = EditorGUILayout.BeginToggleGroup($"Simulate ({shortcut})", NotchSimulatorUtility.enableSimulation);
            EditorGUI.indentLevel++;

            NotchSimulatorUtility.selectedDevice  = (SimulationDevice)EditorGUILayout.EnumPopup(NotchSimulatorUtility.selectedDevice);
            NotchSimulatorUtility.flipOrientation = EditorGUILayout.Toggle("Flip Orientation", NotchSimulatorUtility.flipOrientation);

            var simulationDevice = SimulationDatabase.db[NotchSimulatorUtility.selectedDevice];

            //Draw warning about wrong aspect ratio
            if (enableSimulation)
            {
                ScreenOrientation gameViewOrientation = NotchSimulatorUtility.GetGameViewOrientation();

                Vector2 simSize = gameViewOrientation == ScreenOrientation.Portrait ?
                                  simulationDevice.screenSize : new Vector2(simulationDevice.screenSize.y, simulationDevice.screenSize.x);

                Vector2 gameViewSize = NotchSimulatorUtility.GetMainGameViewSize();
                if (gameViewOrientation == ScreenOrientation.Landscape)
                {
                    var flip = gameViewSize.x;
                    gameViewSize.x = gameViewSize.y;
                    gameViewSize.y = flip;
                }

                var simAspect      = NotchSolutionUtility.ScreenRatio(simulationDevice.screenSize);
                var gameViewAspect = NotchSolutionUtility.ScreenRatio(gameViewSize);
                var aspectDiff     = Math.Abs((simAspect.x / simAspect.y) - (gameViewAspect.x / gameViewAspect.y));
                if (aspectDiff > 0.01f)
                {
                    EditorGUILayout.HelpBox($"The selected simulation device has an aspect ratio of {simAspect.y}:{simAspect.x} ({simulationDevice.screenSize.y}x{simulationDevice.screenSize.x}) but your game view is currently in aspect {gameViewAspect.y}:{gameViewAspect.x} ({gameViewSize.y}x{gameViewSize.x}). The overlay mockup will be stretched from its intended ratio.", MessageType.Warning);
                }
            }

            EditorGUI.indentLevel--;
            EditorGUILayout.EndToggleGroup();
            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                UpdateAllMockups();
            }

            UpdateSimulatorTargets();
        }
예제 #4
0
        void OnGUI()
        {
            //Sometimes even with flag I can see it in hierarchy until I move a mouse over it??
            EditorApplication.RepaintHierarchyWindow();

            bool enableSimulation = NotchSimulatorUtility.enableSimulation;

            EditorGUI.BeginChangeCheck();
            NotchSimulatorUtility.enableSimulation = EditorGUILayout.BeginToggleGroup("Simulate", NotchSimulatorUtility.enableSimulation);
            EditorGUI.indentLevel++;

            NotchSimulatorUtility.selectedDevice  = (SimulationDevice)EditorGUILayout.EnumPopup(NotchSimulatorUtility.selectedDevice);
            NotchSimulatorUtility.flipOrientation = EditorGUILayout.Toggle("Flip Orientation", NotchSimulatorUtility.flipOrientation);

            var simulationDevice = SimulationDatabase.db[NotchSimulatorUtility.selectedDevice];

            //Draw warning about wrong aspect ratio
            if (enableSimulation)
            {
                ScreenOrientation gameViewOrientation = NotchSimulatorUtility.GetGameViewOrientation();

                Vector2 simSize = gameViewOrientation == ScreenOrientation.Portrait ?
                                  simulationDevice.screenSize : new Vector2(simulationDevice.screenSize.y, simulationDevice.screenSize.x);

                Vector2 gameViewSize = NotchSimulatorUtility.GetMainGameViewSize();
                if (gameViewOrientation == ScreenOrientation.Landscape)
                {
                    var flip = gameViewSize.x;
                    gameViewSize.x = gameViewSize.y;
                    gameViewSize.y = flip;
                }

                var simAspect      = ScreenRatio(simulationDevice.screenSize);
                var gameViewAspect = ScreenRatio(gameViewSize);
                var aspectDiff     = Math.Abs((simAspect.x / simAspect.y) - (gameViewAspect.x / gameViewAspect.y));
                if (aspectDiff > 0.01f)
                {
                    EditorGUILayout.HelpBox($"The selected simulation device has an aspect ratio of {simAspect.y}:{simAspect.x} ({simulationDevice.screenSize.y}x{simulationDevice.screenSize.x}) but your game view is currently in aspect {gameViewAspect.y}:{gameViewAspect.x} ({gameViewSize.y}x{gameViewSize.x}). The overlay mockup will be stretched from its intended ratio.", MessageType.Warning);
                }
            }

            EditorGUI.indentLevel--;
            EditorGUILayout.EndToggleGroup();
            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                UpdateMockup();
            }

            if (enableSimulation || (!enableSimulation && NotchSimulatorUtility.enableSimulation))
            {
                NotchSolutionUtility.SimulateSafeAreaRelative = NotchSimulatorUtility.enableSimulation ? NotchSimulatorUtility.SimulatorSafeAreaRelative : new Rect(0, 0, 1, 1);
                var nps = GameObject.FindObjectsOfType <UIBehaviour>().OfType <INotchSimulatorTarget>();
                foreach (var np in nps)
                {
                    np.SimulatorUpdate();
                }
            }
        }
예제 #5
0
        //TODO : Game view related reflection methods should be cached.

        private void UpdateMockup(SimulationDevice simDevice)
        {
            bool       enableSimulation = NotchSimulatorUtility.enableSimulation;
            GameObject mockupCanvas     = GameObject.Find(mockupCanvasName);

            if (enableSimulation)
            {
                //Landscape has an alias that turns ToString into LandscapeLeft lol
                var orientationString = NotchSimulatorUtility.GetGameViewOrientation() == ScreenOrientation.Landscape ? nameof(ScreenOrientation.Landscape) : nameof(ScreenOrientation.Portrait);
                var name  = $"{prefix}-{simDevice.ToString()}-{orientationString}";
                var guids = AssetDatabase.FindAssets(name);
                var first = guids.FirstOrDefault();
                if (first == default(string))
                {
                    throw new InvalidOperationException($"No mockup image named {name} in NotchSolution/Editor/Mockups folder!");
                }
                Sprite mockupSprite = AssetDatabase.LoadAssetAtPath <Sprite>(AssetDatabase.GUIDToAssetPath(first));
                if (mockupCanvas == null)
                {
                    var        prefabGuids        = AssetDatabase.FindAssets(mockupCanvasName);
                    GameObject mockupCanvasPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath(prefabGuids.First()));
                    mockupCanvas           = (GameObject)PrefabUtility.InstantiatePrefab(mockupCanvasPrefab);
                    mockupCanvas.hideFlags = HideFlags.HideAndDontSave | HideFlags.NotEditable | HideFlags.HideInInspector;
                }
                var mc = mockupCanvas.GetComponent <MockupCanvas>();

                mc.SetMockupSprite(mockupSprite, NotchSimulatorUtility.GetGameViewOrientation(), simulate: enableSimulation, flipped: NotchSimulatorUtility.flipOrientation);
            }
            else
            {
                GameObject.DestroyImmediate(mockupCanvas);
            }
        }
예제 #6
0
        internal static void UpdateAllMockups()
        {
            //When building, the scene may open-close multiple times and brought back the mockup canvas,
            //which combined with bugs mentioned at https://github.com/5argon/NotchSolution/issues/11,
            //will fail the build. This `if` prevents mockup refresh while building.
            if (BuildPipeline.isBuildingPlayer)
            {
                return;
            }

            EnsureCanvasAndEventSetup();

            //Make the editing environment contains an another copy of mockup canvas.
            var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();

            if (prefabStage != null)
            {
                EnsureCanvasAndEventSetup(prefabStage: prefabStage);
            }

            bool enableSimulation = NotchSimulatorUtility.enableSimulation;

            if (enableSimulation)
            {
                //Landscape has an alias that turns ToString into LandscapeLeft lol
                var orientationString      = NotchSimulatorUtility.GetGameViewOrientation() == ScreenOrientation.Landscape ? nameof(ScreenOrientation.Landscape) : nameof(ScreenOrientation.Portrait);
                SimulationDevice simDevice = NotchSimulatorUtility.selectedDevice;
                var name  = $"{prefix}-{simDevice.ToString()}-{orientationString}";
                var guids = AssetDatabase.FindAssets(name);
                var first = guids.FirstOrDefault();

                if (first == default(string))
                {
                    throw new InvalidOperationException($"No mockup image named {name} in NotchSolution/Editor/Mockups folder!");
                }
                Sprite mockupSprite = AssetDatabase.LoadAssetAtPath <Sprite>(AssetDatabase.GUIDToAssetPath(first));

                foreach (var mockup in AllMockupCanvases)
                {
                    mockup.Show();
                    mockup.SetMockupSprite(
                        sprite: mockupSprite,
                        orientation: NotchSimulatorUtility.GetGameViewOrientation(),
                        simulate: enableSimulation,
                        flipped: NotchSimulatorUtility.flipOrientation
                        );
                }
            }
            else
            {
                foreach (var mockup in AllMockupCanvases)
                {
                    mockup.Hide();
                }
            }
        }
예제 #7
0
        internal static void UpdateAllMockups()
        {
            EnsureCanvasAndEventSetup();

            //Make the editing environment contains an another copy of mockup canvas.
            var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();

            if (prefabStage != null)
            {
                EnsureCanvasAndEventSetup(prefabStage: prefabStage);
            }

            bool enableSimulation = NotchSimulatorUtility.enableSimulation;

            if (enableSimulation)
            {
                //Landscape has an alias that turns ToString into LandscapeLeft lol
                var orientationString      = NotchSimulatorUtility.GetGameViewOrientation() == ScreenOrientation.Landscape ? nameof(ScreenOrientation.Landscape) : nameof(ScreenOrientation.Portrait);
                SimulationDevice simDevice = NotchSimulatorUtility.selectedDevice;
                var name  = $"{prefix}-{simDevice.ToString()}-{orientationString}";
                var guids = AssetDatabase.FindAssets(name);
                var first = guids.FirstOrDefault();

                if (first == default(string))
                {
                    throw new InvalidOperationException($"No mockup image named {name} in NotchSolution/Editor/Mockups folder!");
                }
                Sprite mockupSprite = AssetDatabase.LoadAssetAtPath <Sprite>(AssetDatabase.GUIDToAssetPath(first));

                foreach (var mockup in AllMockupCanvases)
                {
                    mockup.Show();
                    mockup.SetMockupSprite(
                        sprite: mockupSprite,
                        orientation: NotchSimulatorUtility.GetGameViewOrientation(),
                        simulate: enableSimulation,
                        flipped: NotchSimulatorUtility.flipOrientation
                        );
                }
            }
            else
            {
                foreach (var mockup in AllMockupCanvases)
                {
                    mockup.Hide();
                }
            }
        }
예제 #8
0
        internal static void UpdateAllMockups()
        {
            //When building, the scene may open-close multiple times and brought back the mockup canvas,
            //which combined with bugs mentioned at https://github.com/5argon/NotchSolution/issues/11,
            //will fail the build. This `if` prevents mockup refresh while building.
            if (BuildPipeline.isBuildingPlayer)
            {
                return;
            }

            EnsureCanvasAndEventSetup();

            //Make the editing environment contains an another copy of mockup canvas.
            var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();

            if (prefabStage != null)
            {
                EnsureCanvasAndEventSetup(prefabStage: prefabStage);
            }

            var  settings         = Settings.Instance;
            bool enableSimulation = settings.EnableSimulation;
            var  selectedDevice   = SimulationDatabase.ByIndex(Settings.Instance.ActiveConfiguration.DeviceIndex);

            if (enableSimulation && selectedDevice != null)
            {
                var    name         = selectedDevice.Meta.overlay;
                Sprite mockupSprite = null;
                if (!string.IsNullOrEmpty(name))
                {
                    var filePath = Path.Combine(NotchSimulatorUtility.DevicesFolder, name);
                    mockupSprite = AssetDatabase.LoadAssetAtPath <Sprite>(filePath);
                    if (mockupSprite == null)
                    {
                        if (System.IO.File.Exists(filePath))
                        {
                            Texture2D tex = new Texture2D(1, 1);
                            tex.LoadImage(System.IO.File.ReadAllBytes(filePath));
                            mockupSprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f);
                        }
                        else
                        {
                            Debug.LogWarning($"No mockup image named {name} in {NotchSimulatorUtility.DevicesFolder} folder!");
                        }
                    }
                }


                foreach (var mockup in AllMockupCanvases)
                {
                    mockup.UpdateMockupSprite(
                        sprite: mockupSprite,
                        orientation: NotchSimulatorUtility.GetGameViewOrientation(),
                        simulate: enableSimulation,
                        flipped: settings.FlipOrientation,
                        prefabModeOverlayColor: Settings.Instance.PrefabModeOverlayColor
                        );
                }
            }
            else
            {
                DestroyHiddenCanvas();
            }
        }
예제 #9
0
        /// <summary>
        /// It is currently active only when Notch Simulator tab is present.
        /// </summary>
        void OnGUI()
        {
            win = this;

            //Sometimes even with flag I can see it in hierarchy until I move a mouse over it??
            EditorApplication.RepaintHierarchyWindow();

            EditorGUI.BeginChangeCheck();

            var settings = Settings.Instance;

            string switchConfigShortcut = ShortcutManager.instance.GetShortcutBinding(NotchSolutionShortcuts.switchConfigurationShortcut).ToString();

            if (string.IsNullOrEmpty(switchConfigShortcut))
            {
                switchConfigShortcut = "None";
            }
            string simulateShortcut = ShortcutManager.instance.GetShortcutBinding(NotchSolutionShortcuts.toggleSimulationShortcut).ToString();

            if (string.IsNullOrEmpty(simulateShortcut))
            {
                simulateShortcut = "None";
            }

            settings.EnableSimulation = EditorGUILayout.BeginToggleGroup($"Simulate ({simulateShortcut})", settings.EnableSimulation);

            int previousIndex = settings.ActiveConfiguration.DeviceIndex;
            int currentIndex  = Mathf.Clamp(settings.ActiveConfiguration.DeviceIndex, 0, SimulationDatabase.KeyList.Length - 1);

            int selectedIndex = EditorGUILayout.Popup(currentIndex, SimulationDatabase.KeyList);

            if (GUILayout.Button($"{settings.ActiveConfiguration.ConfigurationName} ({switchConfigShortcut})", EditorStyles.helpBox))
            {
                NotchSolutionShortcuts.SwitchConfiguration();
            }
            EditorGUILayout.EndToggleGroup();

            settings.ActiveConfiguration.DeviceIndex = selectedIndex;

            var simulationDevice = SimulationDatabase.Get(SimulationDatabase.KeyList[selectedIndex]);

            //Draw warning about wrong aspect ratio
            if (settings.EnableSimulation && simulationDevice != null)
            {
                ScreenOrientation gameViewOrientation = NotchSimulatorUtility.GetGameViewOrientation();

                Vector2 gameViewSize = NotchSimulatorUtility.GetMainGameViewSize();
                if (gameViewOrientation == ScreenOrientation.Landscape)
                {
                    var flip = gameViewSize.x;
                    gameViewSize.x = gameViewSize.y;
                    gameViewSize.y = flip;
                }

                var screen         = simulationDevice.Screens.FirstOrDefault();
                var simAspect      = NotchSolutionUtilityEditor.ScreenRatio(new Vector2(screen.width, screen.height));
                var gameViewAspect = NotchSolutionUtilityEditor.ScreenRatio(gameViewSize);
                var aspectDiff     = Math.Abs((simAspect.x / simAspect.y) - (gameViewAspect.x / gameViewAspect.y));
                if (aspectDiff > 0.01f)
                {
                    EditorGUILayout.HelpBox($"The selected simulation device has an aspect ratio of {simAspect.y}:{simAspect.x} ({screen.height}x{screen.width}) but your game view is currently in aspect {gameViewAspect.y}:{gameViewAspect.x} ({gameViewSize.y}x{gameViewSize.x}). The overlay mockup won't be displayed correctly.", MessageType.Warning);
                }
            }

            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                UpdateAllMockups();
                settings.Save();
            }

            UpdateSimulatorTargets();
        }
예제 #10
0
        private static void UpdateMockup()
        {
            bool enableSimulation = NotchSimulatorUtility.enableSimulation;

            //Create the hidden canvas if not already.
            if (canvasObject == null)
            {
                //Find existing in the case of assembly reload
                canvasObject = GameObject.Find(mockupCanvasName);
                if (canvasObject != null)
                {
                    //Debug.Log($"Found existing");
                    mockupCanvas = canvasObject.GetComponent <MockupCanvas>();
                }
                else
                {
                    //Debug.Log($"Creating canvas");
                    var        prefabGuids        = AssetDatabase.FindAssets(mockupCanvasName);
                    GameObject mockupCanvasPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath(prefabGuids.First()));
                    canvasObject           = (GameObject)PrefabUtility.InstantiatePrefab(mockupCanvasPrefab);
                    mockupCanvas           = canvasObject.GetComponent <MockupCanvas>();
                    canvasObject.hideFlags = overlayCanvasFlag;

                    if (Application.isPlaying)
                    {
                        DontDestroyOnLoad(canvasObject);
                    }
                }

                if (eventAdded == false)
                {
                    eventAdded = true;

                    //Add clean up event.
                    EditorApplication.playModeStateChanged += PlayModeStateChangeAction;
                    // EditorSceneManager.sceneClosing += (a, b) =>
                    // {
                    //     Debug.Log($"Scene closing {a} {b}");
                    // };
                    // EditorSceneManager.sceneClosed += (a) =>
                    // {
                    //     Debug.Log($"Scene closed {a}");
                    // };
                    // EditorSceneManager.sceneLoaded += (a, b) =>
                    //  {
                    //      Debug.Log($"Scene loaded {a} {b}");
                    //  };
                    // EditorSceneManager.sceneUnloaded += (a) =>
                    //  {
                    //      Debug.Log($"Scene unloaded {a}");
                    //  };
                    EditorSceneManager.sceneOpening += (a, b) =>
                    {
                        //Debug.Log($"Scene opening {a} {b}");
                        DestroyHiddenCanvas();
                    };
                    EditorSceneManager.sceneOpened += (a, b) =>
                    {
                        //Debug.Log($"Scene opened {a} {b}");
                        UpdateMockup();
                    };

                    void PlayModeStateChangeAction(PlayModeStateChange state)
                    {
                        //Debug.Log($"Changed state PLAY {EditorApplication.isPlaying} PLAY or WILL CHANGE {EditorApplication.isPlayingOrWillChangePlaymode}");
                        switch (state)
                        {
                        case PlayModeStateChange.EnteredEditMode:
                            //Debug.Log($"Entered Edit {canvasObject}");
                            AddOverlayInPlayMode();     //For when coming back from play mode.
                            break;

                        case PlayModeStateChange.EnteredPlayMode:
                            //Debug.Log($"Entered Play {canvasObject}");
                            break;

                        case PlayModeStateChange.ExitingEditMode:
                            //Debug.Log($"Exiting Edit {canvasObject}");
                            DestroyHiddenCanvas();    //Clean up the DontSave canvas we made in edit mode.
                            break;

                        case PlayModeStateChange.ExitingPlayMode:
                            //Debug.Log($"Exiting Play {canvasObject}");
                            DestroyHiddenCanvas();    //Clean up the DontSave canvas we made in play mode.
                            break;
                        }
                    }
                }
            }

            if (enableSimulation)
            {
                //Landscape has an alias that turns ToString into LandscapeLeft lol
                var orientationString      = NotchSimulatorUtility.GetGameViewOrientation() == ScreenOrientation.Landscape ? nameof(ScreenOrientation.Landscape) : nameof(ScreenOrientation.Portrait);
                SimulationDevice simDevice = NotchSimulatorUtility.selectedDevice;
                var name  = $"{prefix}-{simDevice.ToString()}-{orientationString}";
                var guids = AssetDatabase.FindAssets(name);
                var first = guids.FirstOrDefault();

                if (first == default(string))
                {
                    throw new InvalidOperationException($"No mockup image named {name} in NotchSolution/Editor/Mockups folder!");
                }
                Sprite mockupSprite = AssetDatabase.LoadAssetAtPath <Sprite>(AssetDatabase.GUIDToAssetPath(first));

                mockupCanvas.Show();
                mockupCanvas.SetMockupSprite(mockupSprite, NotchSimulatorUtility.GetGameViewOrientation(), simulate: enableSimulation, flipped: NotchSimulatorUtility.flipOrientation);
            }
            else
            {
                mockupCanvas.Hide();
            }
        }