void Start() { consoleModel = Shell.getGameConsoleModel(); consoleModel.enable(); //model.onClear += consoleModel.onHideConsole += hideConsole; consoleModel.onHideEditor += hideEditor; consoleModel.onHideHistory += hideHistory; consoleModel.onHideLog += hideLog; consoleModel.onLoadScript += (v => codeEditor = v); consoleModel.onNewMessage += (m => newPrint = true); consoleModel.onRunCurrent += (() => consoleModel.runString(codeEditor)); consoleModel.onSaveCurrent += (() => consoleModel.saveScriptWithCode(uri, codeEditor)); consoleModel.onSaveToNew += (v => consoleModel.saveScriptWithCode(v, codeEditor)); consoleModel.onShowAll += showConsole; consoleModel.onShowEditor += showEditor; consoleModel.onShowHistory += showHistory; consoleModel.onShowLog += showLog; // Assure uniqueness if (instance != null) { consoleModel.printError("There is already a console in game"); Debug.Log("There is already a console in game"); Destroy(this); return; } instance = this; historyRank = -1; commandSave = ""; historyScroll = Vector2.zero; currentConsoleCode = new List <string> (); parDepth = 0; currentConsoleCommand = ""; codeEditor = ""; uri = null; mainBox = new Rect(); historyBox = new Rect(); consoleBox = new Rect(); editorBox = new Rect(); logBox = new Rect(); updatePositions(); cacheScreenHeight = Screen.height; cacheScreenWidth = Screen.width; logScroll = Vector2.zero; }