Exemplo n.º 1
0
        void InitGui(ExperimentRunner experimentRunner)
        {
            gameObject.SetActive(true);
            int targetDisplay = experimentRunner.DesignFile.GetGuiSettings.TargetDisplay;

            if (Display.displays.Length > targetDisplay || Application.isEditor)
            {
                if (!Application.isEditor)
                {
                    Display.displays[targetDisplay].Activate();
                }

                Debug.Log($"{TuxLog.Prefix} Setting UI to show on Display {targetDisplay + 1}. Click here to highlight current settings file in project.", experimentRunner.DesignFile.GetGuiSettings);
                if (targetDisplay > 0 && experimentRunner.DesignFile.GetGuiSettings.WarnUserIfNotDisplayOne)
                {
                    Debug.LogWarning(TuxLog.Warn("UI is on secondary display. If you can't see UI, adjust settings. You can turn this warning off (click on this message)."), experimentRunner.DesignFile.GetGuiSettings);
                }
            }
            else
            {
                Debug.LogWarning($"{TuxLog.Prefix} Not enough displays plugged in to accommodate your UI settings. Reverting UI to display on {Display.displays.Length}");
                targetDisplay = Display.displays.Length;
            }

            Canvas.targetDisplay = targetDisplay;
            if (targetDisplay != 0)
            {
                placeholderCamera.targetDisplay = targetDisplay;
            }
        }