Esempio n. 1
0
    void Start()
    {
        var evsys = GameObject.FindObjectOfType <EventSystem>();

        if (!evsys)
        {
            Debug.LogError("UnityEvent System not found in scene, manually add it.");
            Debug.Break();
        }
        GameObject prefab = Resources.Load <GameObject>("BeastConsole/BeastConsole");

        consoleRoot = GameObject.Instantiate(prefab);
        consoleRoot.transform.SetParent(transform);
        SmartConsole.options        = Options;
        SmartConsole.entryTemplate  = Resources.Load <GameObject>("BeastConsole/ConsoleEntry");
        SmartConsole.consoleContent = consoleRoot.transform.FindDeepChild("Content").gameObject;
        SmartConsole.consoleRoot    = consoleRoot.transform.FindDeepChild("Root").GetComponent <RectTransform>();
        SmartConsole.inputField     = consoleRoot.transform.FindDeepChild("InputField").GetComponent <InputField>();
        SmartConsole.scrollBar      = consoleRoot.transform.FindDeepChild("Scrollbar Vertical").GetComponent <Scrollbar>();
        fps_display = consoleRoot.transform.FindDeepChild("fps_display").gameObject;

        CFG.Initialize();

        CFG.showfps.OnChanged += x => { fps_display.SetActive(x); CFG.minFPS.Set(120); CFG.maxFPS.Set(0); };
        CFG.showfps.Set(ShowFps);
        consoleRoot.AddComponent <SmartConsole>();

        StartCoroutine(TrackFPS());
    }