Example #1
0
    void Start()
    {
        SetCursor("Cursor", new Vector2(5, 5));

        Instance = this;
        Initialize();

        GuiScaleManager.AutoSetGuiScale();

        previousResolution.width  = Screen.width;
        previousResolution.height = Screen.height;
        previousGuiScale          = GuiScaleManager.GuiScale;
    }
Example #2
0
    void OnGUI()
    {
        UnityOnGuiIsRepaint = (Event.current.rawType == EventType.Repaint);

        if (!ComponentsInitialized)
        {
            InitializeComponents();
        }

        if (previousGuiScale != GuiScale)
        {
            previousGuiScale = GuiScale;
            UpdateStateResolutions();
        }

        if (Screen.height != previousResolution.height || Screen.width != previousResolution.width)
        {
            Trace.Log("Screen resolution changed to {0}x{1}", Screen.width, Screen.height);
            previousResolution.width  = Screen.width;
            previousResolution.height = Screen.height;
            GuiScaleManager.AutoSetGuiScale();
            UpdateStateResolutions();
        }

        if (GUI.skin != Skin)
        {
            GUI.skin = Skin;
        }

        if (Time.frameCount != lastOnGuiCall)
        {
            // this gets called once per frame.
            PerformanceStatsLastFrame = PerformanceStatsInProgress;
            PerformanceStatsInProgress.Clear();
            PerformanceStatsInProgress.FrameTime = Time.deltaTime;

            PerformanceStatsInProgress.UpdateTime = MeasureExecutionTime(DoUpdate);

            lastOnGuiCall = Time.frameCount;
        }

        PerformanceStatsInProgress.GuiCallRegister.Add(Event.current.ToString());

        PerformanceStatsInProgress.DrawTime += MeasureExecutionTime(DoDraw);
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     instance = this;
 }